From dfa3afcdda488ac70b70955751708c8335a36542 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 20 Dec 2024 07:53:19 +0000 Subject: [PATCH] CodeGen from PR 31890 in Azure/azure-rest-api-specs Merge 51c990d57975d229a6e3e2a2d4a328d1b11a4fd3 into 1cb540f95dc8993540918943a75d02ebfeeda0ca --- .../CHANGELOG.md | 5 + .../azure-mgmt-migrationassessment/LICENSE | 21 + .../MANIFEST.in | 8 + .../azure-mgmt-migrationassessment/README.md | 61 + .../azure-mgmt-migrationassessment/_meta.json | 11 + .../azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../mgmt/migrationassessment/__init__.py | 32 + .../_azure_migrate_assessment_service.py | 439 + .../migrationassessment/_configuration.py | 64 + .../azure/mgmt/migrationassessment/_patch.py | 20 + .../migrationassessment/_serialization.py | 2118 ++ .../mgmt/migrationassessment/_version.py | 9 + .../mgmt/migrationassessment/aio/__init__.py | 29 + .../aio/_azure_migrate_assessment_service.py | 441 + .../migrationassessment/aio/_configuration.py | 64 + .../mgmt/migrationassessment/aio/_patch.py | 20 + .../aio/operations/__init__.py | 115 + .../_aks_assessment_operations_operations.py | 635 + .../_aks_cluster_operations_operations.py | 216 + .../_aks_cost_detail_operations_operations.py | 151 + .../_aks_options_operations_operations.py | 203 + .../_aks_summary_operations_operations.py | 208 + ...assessed_machines_operations_operations.py | 242 + ...d_sql_database_v2_operations_operations.py | 246 + ...d_sql_instance_v2_operations_operations.py | 246 + ...ssed_sql_machines_operations_operations.py | 245 + ...ecommended_entity_operations_operations.py | 247 + ...sessed_web_app_v2_operations_operations.py | 245 + ...d_web_application_operations_operations.py | 232 + ...ssessment_options_operations_operations.py | 206 + ...t_project_summary_operations_operations.py | 206 + ...sessment_projects_operations_operations.py | 740 + .../_assessments_operations_operations.py | 654 + ...assessed_machines_operations_operations.py | 245 + ...ssessment_options_operations_operations.py | 207 + .../_avs_assessments_operations_operations.py | 657 + ..._case_avs_summary_operations_operations.py | 211 + ...case_iaas_summary_operations_operations.py | 216 + .../_business_case_operations_operations.py | 752 + ..._overview_summary_operations_operations.py | 216 + ...case_paas_summary_operations_operations.py | 216 + ...ated_avs_machines_operations_operations.py | 237 + ...valuated_machines_operations_operations.py | 237 + ...ated_sql_entities_operations_operations.py | 237 + ...valuated_web_apps_operations_operations.py | 237 + .../_groups_operations_operations.py | 689 + ...hyperv_collectors_operations_operations.py | 484 + ...import_collectors_operations_operations.py | 484 + .../_machines_operations_operations.py | 221 + .../aio/operations/_operations.py | 130 + .../aio/operations/_patch.py | 20 + ...dpoint_connection_operations_operations.py | 485 + ...ate_link_resource_operations_operations.py | 205 + ...server_collectors_operations_operations.py | 484 + ...ssessment_options_operations_operations.py | 207 + ...sql_assessment_v2_operations_operations.py | 657 + ...ssment_v2_summary_operations_operations.py | 224 + .../_sql_collector_operations_operations.py | 479 + ...vmware_collectors_operations_operations.py | 484 + ...ssessment_options_operations_operations.py | 207 + ...app_assessment_v2_operations_operations.py | 657 + ...ssment_v2_summary_operations_operations.py | 224 + ...web_app_collector_operations_operations.py | 482 + ...p_service_plan_v2_operations_operations.py | 245 + .../migrationassessment/models/__init__.py | 850 + ..._azure_migrate_assessment_service_enums.py | 1973 ++ .../migrationassessment/models/_models_py3.py | 17067 ++++++++++++++++ .../mgmt/migrationassessment/models/_patch.py | 20 + .../operations/__init__.py | 115 + .../_aks_assessment_operations_operations.py | 827 + .../_aks_cluster_operations_operations.py | 299 + .../_aks_cost_detail_operations_operations.py | 195 + .../_aks_options_operations_operations.py | 274 + .../_aks_summary_operations_operations.py | 283 + ...assessed_machines_operations_operations.py | 342 + ...d_sql_database_v2_operations_operations.py | 344 + ...d_sql_instance_v2_operations_operations.py | 344 + ...ssed_sql_machines_operations_operations.py | 342 + ...ecommended_entity_operations_operations.py | 345 + ...sessed_web_app_v2_operations_operations.py | 342 + ...d_web_application_operations_operations.py | 326 + ...ssessment_options_operations_operations.py | 273 + ...t_project_summary_operations_operations.py | 274 + ...sessment_projects_operations_operations.py | 916 + .../_assessments_operations_operations.py | 847 + ...assessed_machines_operations_operations.py | 342 + ...ssessment_options_operations_operations.py | 275 + .../_avs_assessments_operations_operations.py | 850 + ..._case_avs_summary_operations_operations.py | 287 + ...case_iaas_summary_operations_operations.py | 294 + .../_business_case_operations_operations.py | 979 + ..._overview_summary_operations_operations.py | 294 + ...case_paas_summary_operations_operations.py | 294 + ...ated_avs_machines_operations_operations.py | 335 + ...valuated_machines_operations_operations.py | 334 + ...ated_sql_entities_operations_operations.py | 334 + ...valuated_web_apps_operations_operations.py | 334 + .../_groups_operations_operations.py | 861 + ...hyperv_collectors_operations_operations.py | 620 + ...import_collectors_operations_operations.py | 620 + .../_machines_operations_operations.py | 306 + .../operations/_operations.py | 151 + .../migrationassessment/operations/_patch.py | 20 + ...dpoint_connection_operations_operations.py | 637 + ...ate_link_resource_operations_operations.py | 273 + ...server_collectors_operations_operations.py | 620 + ...ssessment_options_operations_operations.py | 275 + ...sql_assessment_v2_operations_operations.py | 850 + ...ssment_v2_summary_operations_operations.py | 305 + .../_sql_collector_operations_operations.py | 614 + ...vmware_collectors_operations_operations.py | 620 + ...ssessment_options_operations_operations.py | 275 + ...app_assessment_v2_operations_operations.py | 853 + ...ssment_v2_summary_operations_operations.py | 305 + ...web_app_collector_operations_operations.py | 614 + ...p_service_plan_v2_operations_operations.py | 343 + .../azure/mgmt/migrationassessment/py.typed | 1 + ...sment_operations_create_maximum_set_gen.py | 69 + ...sment_operations_delete_maximum_set_gen.py | 42 + ...sessment_operations_get_maximum_set_gen.py | 43 + ...t_by_assessment_project_maximum_set_gen.py | 43 + ..._cluster_operations_get_maximum_set_gen.py | 44 + ..._list_by_aks_assessment_maximum_set_gen.py | 44 + ..._list_by_aks_assessment_maximum_set_gen.py | 44 + ..._options_operations_get_maximum_set_gen.py | 43 + ...t_by_assessment_project_maximum_set_gen.py | 43 + ..._summary_operations_get_maximum_set_gen.py | 44 + ..._list_by_aks_assessment_maximum_set_gen.py | 44 + ...machines_operations_get_maximum_set_gen.py | 45 + ...ions_list_by_assessment_maximum_set_gen.py | 45 + ...abase_v2_operations_get_maximum_set_gen.py | 45 + ...st_by_sql_assessment_v2_maximum_set_gen.py | 45 + ...tance_v2_operations_get_maximum_set_gen.py | 45 + ...st_by_sql_assessment_v2_maximum_set_gen.py | 45 + ...machines_operations_get_maximum_set_gen.py | 45 + ...st_by_sql_assessment_v2_maximum_set_gen.py | 45 + ...d_entity_operations_get_maximum_set_gen.py | 45 + ...st_by_sql_assessment_v2_maximum_set_gen.py | 45 + ...b_app_v2_operations_get_maximum_set_gen.py | 45 + ...y_web_app_assessment_v2_maximum_set_gen.py | 45 + ...lication_operations_get_maximum_set_gen.py | 44 + ..._list_by_aks_assessment_maximum_set_gen.py | 44 + ..._options_operations_get_maximum_set_gen.py | 43 + ...t_by_assessment_project_maximum_set_gen.py | 43 + ..._summary_operations_get_maximum_set_gen.py | 43 + ...t_by_assessment_project_maximum_set_gen.py | 43 + ...jects_operations_create_maximum_set_gen.py | 55 + ...jects_operations_delete_maximum_set_gen.py | 41 + ...projects_operations_get_maximum_set_gen.py | 42 + ..._list_by_resource_group_maximum_set_gen.py | 42 + ...ns_list_by_subscription_maximum_set_gen.py | 40 + ...jects_operations_update_maximum_set_gen.py | 54 + ...ments_operations_create_maximum_set_gen.py | 72 + ...ments_operations_delete_maximum_set_gen.py | 43 + ...essments_operations_get_maximum_set_gen.py | 44 + ...perations_list_by_group_maximum_set_gen.py | 44 + ...machines_operations_get_maximum_set_gen.py | 45 + ..._list_by_avs_assessment_maximum_set_gen.py | 45 + ..._options_operations_get_maximum_set_gen.py | 43 + ...t_by_assessment_project_maximum_set_gen.py | 43 + ...ments_operations_create_maximum_set_gen.py | 78 + ...ments_operations_delete_maximum_set_gen.py | 43 + ...essments_operations_get_maximum_set_gen.py | 44 + ...perations_list_by_group_maximum_set_gen.py | 44 + ..._summary_operations_get_maximum_set_gen.py | 44 + ...s_list_by_business_case_maximum_set_gen.py | 44 + ..._summary_operations_get_maximum_set_gen.py | 44 + ...s_list_by_business_case_maximum_set_gen.py | 44 + ..._case_operations_create_maximum_set_gen.py | 116 + ..._case_operations_delete_maximum_set_gen.py | 42 + ...ess_case_operations_get_maximum_set_gen.py | 43 + ...t_by_assessment_project_maximum_set_gen.py | 43 + ..._summary_operations_get_maximum_set_gen.py | 44 + ...s_list_by_business_case_maximum_set_gen.py | 44 + ..._summary_operations_get_maximum_set_gen.py | 44 + ...s_list_by_business_case_maximum_set_gen.py | 44 + ...machines_operations_get_maximum_set_gen.py | 44 + ...s_list_by_business_case_maximum_set_gen.py | 44 + ...machines_operations_get_maximum_set_gen.py | 44 + ...s_list_by_business_case_maximum_set_gen.py | 44 + ...entities_operations_get_maximum_set_gen.py | 44 + ...s_list_by_business_case_maximum_set_gen.py | 44 + ...web_apps_operations_get_maximum_set_gen.py | 44 + ...s_list_by_business_case_maximum_set_gen.py | 44 + ...roups_operations_create_maximum_set_gen.py | 44 + ...roups_operations_delete_maximum_set_gen.py | 42 + .../groups_operations_get_maximum_set_gen.py | 43 + ...t_by_assessment_project_maximum_set_gen.py | 43 + ...rations_update_machines_maximum_set_gen.py | 52 + ...ctors_operations_create_maximum_set_gen.py | 61 + ...ctors_operations_delete_maximum_set_gen.py | 42 + ...llectors_operations_get_maximum_set_gen.py | 43 + ...t_by_assessment_project_maximum_set_gen.py | 43 + ...ctors_operations_create_maximum_set_gen.py | 49 + ...ctors_operations_delete_maximum_set_gen.py | 42 + ...llectors_operations_get_maximum_set_gen.py | 43 + ...t_by_assessment_project_maximum_set_gen.py | 43 + ...machines_operations_get_maximum_set_gen.py | 43 + ...t_by_assessment_project_maximum_set_gen.py | 43 + .../operations_list_maximum_set_gen.py | 40 + ...ction_operations_delete_maximum_set_gen.py | 42 + ...nnection_operations_get_maximum_set_gen.py | 43 + ...t_by_assessment_project_maximum_set_gen.py | 43 + ...ction_operations_update_maximum_set_gen.py | 49 + ...resource_operations_get_maximum_set_gen.py | 43 + ...t_by_assessment_project_maximum_set_gen.py | 43 + ...ctors_operations_create_maximum_set_gen.py | 61 + ...ctors_operations_delete_maximum_set_gen.py | 42 + ...llectors_operations_get_maximum_set_gen.py | 43 + ...t_by_assessment_project_maximum_set_gen.py | 43 + ..._options_operations_get_maximum_set_gen.py | 43 + ...t_by_assessment_project_maximum_set_gen.py | 43 + ...nt_v2_operations_create_maximum_set_gen.py | 79 + ...nt_v2_operations_delete_maximum_set_gen.py | 43 + ...sment_v2_operations_get_maximum_set_gen.py | 44 + ...perations_list_by_group_maximum_set_gen.py | 44 + ..._summary_operations_get_maximum_set_gen.py | 45 + ...st_by_sql_assessment_v2_maximum_set_gen.py | 45 + ...ector_operations_create_maximum_set_gen.py | 60 + ...ector_operations_delete_maximum_set_gen.py | 42 + ...ollector_operations_get_maximum_set_gen.py | 43 + ...t_by_assessment_project_maximum_set_gen.py | 43 + ...ctors_operations_create_maximum_set_gen.py | 61 + ...ctors_operations_delete_maximum_set_gen.py | 42 + ...llectors_operations_get_maximum_set_gen.py | 43 + ...t_by_assessment_project_maximum_set_gen.py | 43 + ..._options_operations_get_maximum_set_gen.py | 43 + ...t_by_assessment_project_maximum_set_gen.py | 43 + ...nt_v2_operations_create_maximum_set_gen.py | 71 + ...nt_v2_operations_delete_maximum_set_gen.py | 43 + ...sment_v2_operations_get_maximum_set_gen.py | 44 + ...perations_list_by_group_maximum_set_gen.py | 44 + ..._summary_operations_get_maximum_set_gen.py | 45 + ...y_web_app_assessment_v2_maximum_set_gen.py | 45 + ...ector_operations_create_maximum_set_gen.py | 60 + ...ector_operations_delete_maximum_set_gen.py | 42 + ...ollector_operations_get_maximum_set_gen.py | 43 + ...t_by_assessment_project_maximum_set_gen.py | 43 + ..._plan_v2_operations_get_maximum_set_gen.py | 45 + ...y_web_app_assessment_v2_maximum_set_gen.py | 45 + .../generated_tests/conftest.py | 47 + ...ce_aks_assessment_operations_operations.py | 132 + ..._assessment_operations_operations_async.py | 137 + ...rvice_aks_cluster_operations_operations.py | 46 + ...aks_cluster_operations_operations_async.py | 47 + ...e_aks_cost_detail_operations_operations.py | 32 + ...cost_detail_operations_operations_async.py | 33 + ...rvice_aks_options_operations_operations.py | 44 + ...aks_options_operations_operations_async.py | 45 + ...rvice_aks_summary_operations_operations.py | 46 + ...aks_summary_operations_operations_async.py | 47 + ...assessed_machines_operations_operations.py | 48 + ...ed_machines_operations_operations_async.py | 49 + ...d_sql_database_v2_operations_operations.py | 48 + ...database_v2_operations_operations_async.py | 49 + ...d_sql_instance_v2_operations_operations.py | 48 + ...instance_v2_operations_operations_async.py | 49 + ...ssed_sql_machines_operations_operations.py | 48 + ...ql_machines_operations_operations_async.py | 49 + ...ecommended_entity_operations_operations.py | 48 + ...nded_entity_operations_operations_async.py | 49 + ...sessed_web_app_v2_operations_operations.py | 48 + ..._web_app_v2_operations_operations_async.py | 49 + ...d_web_application_operations_operations.py | 46 + ...application_operations_operations_async.py | 47 + ...ssessment_options_operations_operations.py | 44 + ...ent_options_operations_operations_async.py | 45 + ...t_project_summary_operations_operations.py | 44 + ...ect_summary_operations_operations_async.py | 45 + ...sessment_projects_operations_operations.py | 152 + ...nt_projects_operations_operations_async.py | 157 + ...rvice_assessments_operations_operations.py | 146 + ...assessments_operations_operations_async.py | 151 + ...assessed_machines_operations_operations.py | 48 + ...ed_machines_operations_operations_async.py | 49 + ...ssessment_options_operations_operations.py | 44 + ...ent_options_operations_operations_async.py | 45 + ...e_avs_assessments_operations_operations.py | 171 + ...assessments_operations_operations_async.py | 181 + ..._case_avs_summary_operations_operations.py | 46 + ...avs_summary_operations_operations_async.py | 47 + ...case_iaas_summary_operations_operations.py | 46 + ...aas_summary_operations_operations_async.py | 47 + ...ice_business_case_operations_operations.py | 190 + ...siness_case_operations_operations_async.py | 199 + ..._overview_summary_operations_operations.py | 46 + ...iew_summary_operations_operations_async.py | 47 + ...case_paas_summary_operations_operations.py | 46 + ...aas_summary_operations_operations_async.py | 47 + ...ated_avs_machines_operations_operations.py | 46 + ...vs_machines_operations_operations_async.py | 47 + ...valuated_machines_operations_operations.py | 46 + ...ed_machines_operations_operations_async.py | 47 + ...ated_sql_entities_operations_operations.py | 46 + ...ql_entities_operations_operations_async.py | 47 + ...valuated_web_apps_operations_operations.py | 46 + ...ed_web_apps_operations_operations_async.py | 47 + ...nt_service_groups_operations_operations.py | 108 + ...vice_groups_operations_operations_async.py | 113 + ...hyperv_collectors_operations_operations.py | 101 + ..._collectors_operations_operations_async.py | 104 + ...import_collectors_operations_operations.py | 89 + ..._collectors_operations_operations_async.py | 92 + ..._service_machines_operations_operations.py | 44 + ...ce_machines_operations_operations_async.py | 45 + ...e_migrate_assessment_service_operations.py | 29 + ...ate_assessment_service_operations_async.py | 30 + ...dpoint_connection_operations_operations.py | 93 + ..._connection_operations_operations_async.py | 96 + ...ate_link_resource_operations_operations.py | 44 + ...nk_resource_operations_operations_async.py | 45 + ...server_collectors_operations_operations.py | 101 + ..._collectors_operations_operations_async.py | 104 + ...ssessment_options_operations_operations.py | 44 + ...ent_options_operations_operations_async.py | 45 + ...sql_assessment_v2_operations_operations.py | 147 + ...sessment_v2_operations_operations_async.py | 155 + ...ssment_v2_summary_operations_operations.py | 48 + ..._v2_summary_operations_operations_async.py | 49 + ...ice_sql_collector_operations_operations.py | 101 + ...l_collector_operations_operations_async.py | 104 + ...vmware_collectors_operations_operations.py | 101 + ..._collectors_operations_operations_async.py | 104 + ...ssessment_options_operations_operations.py | 44 + ...ent_options_operations_operations_async.py | 45 + ...app_assessment_v2_operations_operations.py | 132 + ...sessment_v2_operations_operations_async.py | 141 + ...ssment_v2_summary_operations_operations.py | 48 + ..._v2_summary_operations_operations_async.py | 49 + ...web_app_collector_operations_operations.py | 101 + ...p_collector_operations_operations_async.py | 104 + ...p_service_plan_v2_operations_operations.py | 48 + ...ice_plan_v2_operations_operations_async.py | 49 + .../sdk_packaging.toml | 11 + .../azure-mgmt-migrationassessment/setup.py | 83 + sdk/migrate/ci.yml | 34 + 337 files changed, 72341 insertions(+) create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/CHANGELOG.md create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/LICENSE create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/MANIFEST.in create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/README.md create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/_meta.json create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/__init__.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/__init__.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/__init__.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/_azure_migrate_assessment_service.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/_configuration.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/_patch.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/_serialization.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/_version.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/__init__.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/_azure_migrate_assessment_service.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/_configuration.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/_patch.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/__init__.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_aks_assessment_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_aks_cluster_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_aks_cost_detail_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_aks_options_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_aks_summary_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_machines_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_sql_database_v2_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_sql_instance_v2_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_sql_machines_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_sql_recommended_entity_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_web_app_v2_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_web_application_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessment_options_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessment_project_summary_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessment_projects_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessments_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_avs_assessed_machines_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_avs_assessment_options_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_avs_assessments_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_business_case_avs_summary_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_business_case_iaas_summary_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_business_case_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_business_case_overview_summary_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_business_case_paas_summary_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_evaluated_avs_machines_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_evaluated_machines_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_evaluated_sql_entities_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_evaluated_web_apps_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_groups_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_hyperv_collectors_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_import_collectors_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_machines_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_patch.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_private_endpoint_connection_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_private_link_resource_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_server_collectors_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_sql_assessment_options_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_sql_assessment_v2_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_sql_assessment_v2_summary_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_sql_collector_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_vmware_collectors_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_web_app_assessment_options_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_web_app_assessment_v2_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_web_app_assessment_v2_summary_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_web_app_collector_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_web_app_service_plan_v2_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/models/__init__.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/models/_azure_migrate_assessment_service_enums.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/models/_models_py3.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/models/_patch.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/__init__.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_aks_assessment_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_aks_cluster_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_aks_cost_detail_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_aks_options_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_aks_summary_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_machines_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_sql_database_v2_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_sql_instance_v2_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_sql_machines_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_sql_recommended_entity_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_web_app_v2_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_web_application_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessment_options_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessment_project_summary_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessment_projects_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessments_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_avs_assessed_machines_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_avs_assessment_options_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_avs_assessments_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_business_case_avs_summary_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_business_case_iaas_summary_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_business_case_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_business_case_overview_summary_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_business_case_paas_summary_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_evaluated_avs_machines_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_evaluated_machines_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_evaluated_sql_entities_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_evaluated_web_apps_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_groups_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_hyperv_collectors_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_import_collectors_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_machines_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_patch.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_private_endpoint_connection_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_private_link_resource_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_server_collectors_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_sql_assessment_options_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_sql_assessment_v2_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_sql_assessment_v2_summary_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_sql_collector_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_vmware_collectors_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_web_app_assessment_options_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_web_app_assessment_v2_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_web_app_assessment_v2_summary_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_web_app_collector_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_web_app_service_plan_v2_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/py.typed create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_assessment_operations_create_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_assessment_operations_delete_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_assessment_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_assessment_operations_list_by_assessment_project_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_cluster_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_cluster_operations_list_by_aks_assessment_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_cost_detail_operations_list_by_aks_assessment_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_options_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_options_operations_list_by_assessment_project_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_summary_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_summary_operations_list_by_aks_assessment_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_machines_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_machines_operations_list_by_assessment_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_database_v2_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_database_v2_operations_list_by_sql_assessment_v2_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_instance_v2_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_instance_v2_operations_list_by_sql_assessment_v2_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_machines_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_machines_operations_list_by_sql_assessment_v2_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_recommended_entity_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_recommended_entity_operations_list_by_sql_assessment_v2_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_web_app_v2_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_web_app_v2_operations_list_by_web_app_assessment_v2_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_web_application_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_web_application_operations_list_by_aks_assessment_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_options_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_options_operations_list_by_assessment_project_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_project_summary_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_project_summary_operations_list_by_assessment_project_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_projects_operations_create_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_projects_operations_delete_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_projects_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_projects_operations_list_by_resource_group_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_projects_operations_list_by_subscription_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_projects_operations_update_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessments_operations_create_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessments_operations_delete_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessments_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessments_operations_list_by_group_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessed_machines_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessed_machines_operations_list_by_avs_assessment_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessment_options_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessment_options_operations_list_by_assessment_project_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessments_operations_create_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessments_operations_delete_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessments_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessments_operations_list_by_group_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_avs_summary_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_avs_summary_operations_list_by_business_case_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_iaas_summary_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_iaas_summary_operations_list_by_business_case_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_operations_create_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_operations_delete_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_operations_list_by_assessment_project_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_overview_summary_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_overview_summary_operations_list_by_business_case_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_paas_summary_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_paas_summary_operations_list_by_business_case_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_avs_machines_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_avs_machines_operations_list_by_business_case_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_machines_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_machines_operations_list_by_business_case_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_sql_entities_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_sql_entities_operations_list_by_business_case_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_web_apps_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_web_apps_operations_list_by_business_case_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/groups_operations_create_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/groups_operations_delete_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/groups_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/groups_operations_list_by_assessment_project_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/groups_operations_update_machines_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/hyperv_collectors_operations_create_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/hyperv_collectors_operations_delete_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/hyperv_collectors_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/hyperv_collectors_operations_list_by_assessment_project_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/import_collectors_operations_create_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/import_collectors_operations_delete_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/import_collectors_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/import_collectors_operations_list_by_assessment_project_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/machines_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/machines_operations_list_by_assessment_project_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/operations_list_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/private_endpoint_connection_operations_delete_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/private_endpoint_connection_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/private_endpoint_connection_operations_list_by_assessment_project_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/private_endpoint_connection_operations_update_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/private_link_resource_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/private_link_resource_operations_list_by_assessment_project_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/server_collectors_operations_create_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/server_collectors_operations_delete_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/server_collectors_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/server_collectors_operations_list_by_assessment_project_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_options_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_options_operations_list_by_assessment_project_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_v2_operations_create_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_v2_operations_delete_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_v2_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_v2_operations_list_by_group_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_v2_summary_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_v2_summary_operations_list_by_sql_assessment_v2_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_collector_operations_create_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_collector_operations_delete_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_collector_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_collector_operations_list_by_assessment_project_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/vmware_collectors_operations_create_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/vmware_collectors_operations_delete_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/vmware_collectors_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/vmware_collectors_operations_list_by_assessment_project_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_options_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_options_operations_list_by_assessment_project_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_v2_operations_create_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_v2_operations_delete_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_v2_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_v2_operations_list_by_group_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_v2_summary_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_v2_summary_operations_list_by_web_app_assessment_v2_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_collector_operations_create_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_collector_operations_delete_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_collector_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_collector_operations_list_by_assessment_project_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_service_plan_v2_operations_get_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_service_plan_v2_operations_list_by_web_app_assessment_v2_maximum_set_gen.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/conftest.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_assessment_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_assessment_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_cluster_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_cluster_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_cost_detail_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_cost_detail_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_options_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_options_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_summary_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_summary_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_machines_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_machines_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_database_v2_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_database_v2_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_instance_v2_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_instance_v2_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_machines_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_machines_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_recommended_entity_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_recommended_entity_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_web_app_v2_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_web_app_v2_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_web_application_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_web_application_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessment_options_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessment_options_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessment_project_summary_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessment_project_summary_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessment_projects_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessment_projects_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessments_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessments_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_avs_assessed_machines_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_avs_assessed_machines_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_avs_assessment_options_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_avs_assessment_options_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_avs_assessments_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_avs_assessments_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_avs_summary_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_avs_summary_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_iaas_summary_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_iaas_summary_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_overview_summary_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_overview_summary_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_paas_summary_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_paas_summary_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_avs_machines_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_avs_machines_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_machines_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_machines_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_sql_entities_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_sql_entities_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_web_apps_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_web_apps_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_groups_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_groups_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_hyperv_collectors_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_hyperv_collectors_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_import_collectors_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_import_collectors_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_machines_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_machines_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_private_endpoint_connection_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_private_endpoint_connection_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_private_link_resource_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_private_link_resource_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_server_collectors_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_server_collectors_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_assessment_options_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_assessment_options_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_assessment_v2_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_assessment_v2_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_assessment_v2_summary_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_assessment_v2_summary_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_collector_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_collector_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_vmware_collectors_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_vmware_collectors_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_assessment_options_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_assessment_options_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_assessment_v2_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_assessment_v2_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_assessment_v2_summary_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_assessment_v2_summary_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_collector_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_collector_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_service_plan_v2_operations_operations.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_service_plan_v2_operations_operations_async.py create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/sdk_packaging.toml create mode 100644 sdk/migrate/azure-mgmt-migrationassessment/setup.py create mode 100644 sdk/migrate/ci.yml diff --git a/sdk/migrate/azure-mgmt-migrationassessment/CHANGELOG.md b/sdk/migrate/azure-mgmt-migrationassessment/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/migrate/azure-mgmt-migrationassessment/LICENSE b/sdk/migrate/azure-mgmt-migrationassessment/LICENSE new file mode 100644 index 000000000000..b2f52a2bad4e --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/migrate/azure-mgmt-migrationassessment/MANIFEST.in b/sdk/migrate/azure-mgmt-migrationassessment/MANIFEST.in new file mode 100644 index 000000000000..baac7aa7b500 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/MANIFEST.in @@ -0,0 +1,8 @@ +include _meta.json +recursive-include tests *.py *.json +recursive-include samples *.py *.md +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include LICENSE +include azure/mgmt/migrationassessment/py.typed diff --git a/sdk/migrate/azure-mgmt-migrationassessment/README.md b/sdk/migrate/azure-mgmt-migrationassessment/README.md new file mode 100644 index 000000000000..2fdb6607e5be --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/README.md @@ -0,0 +1,61 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +This package has been tested with Python 3.8+. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + +## _Disclaimer_ + +_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ + +## Getting started + +### Prerequisites + +- Python 3.8+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) + +### Install the package + +```bash +pip install azure-mgmt-migrationassessment +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.migrationassessment import +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = (credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + +Code samples for this package can be found at: +- [Search MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com +- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. diff --git a/sdk/migrate/azure-mgmt-migrationassessment/_meta.json b/sdk/migrate/azure-mgmt-migrationassessment/_meta.json new file mode 100644 index 000000000000..7bf7102bf9d4 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "049ebf87b8ff3104d48623de499fa63278d79b4f", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest": "3.10.2", + "use": [ + "@autorest/python@6.27.2", + "@autorest/modelerfour@4.27.0" + ], + "autorest_command": "autorest specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/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.2 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "readme": "specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/readme.md" +} \ No newline at end of file diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/__init__.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/__init__.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/__init__.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/__init__.py new file mode 100644 index 000000000000..a70b98f76621 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/__init__.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. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._azure_migrate_assessment_service import AzureMigrateAssessmentService # type: ignore +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AzureMigrateAssessmentService", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/_azure_migrate_assessment_service.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/_azure_migrate_assessment_service.py new file mode 100644 index 000000000000..cfef6b441c11 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/_azure_migrate_assessment_service.py @@ -0,0 +1,439 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy + +from . import models as _models +from ._configuration import AzureMigrateAssessmentServiceConfiguration +from ._serialization import Deserializer, Serializer +from .operations import ( + AksAssessmentOperationsOperations, + AksClusterOperationsOperations, + AksCostDetailOperationsOperations, + AksOptionsOperationsOperations, + AksSummaryOperationsOperations, + AssessedMachinesOperationsOperations, + AssessedSqlDatabaseV2OperationsOperations, + AssessedSqlInstanceV2OperationsOperations, + AssessedSqlMachinesOperationsOperations, + AssessedSqlRecommendedEntityOperationsOperations, + AssessedWebAppV2OperationsOperations, + AssessedWebApplicationOperationsOperations, + AssessmentOptionsOperationsOperations, + AssessmentProjectSummaryOperationsOperations, + AssessmentProjectsOperationsOperations, + AssessmentsOperationsOperations, + AvsAssessedMachinesOperationsOperations, + AvsAssessmentOptionsOperationsOperations, + AvsAssessmentsOperationsOperations, + BusinessCaseAvsSummaryOperationsOperations, + BusinessCaseIaasSummaryOperationsOperations, + BusinessCaseOperationsOperations, + BusinessCaseOverviewSummaryOperationsOperations, + BusinessCasePaasSummaryOperationsOperations, + EvaluatedAvsMachinesOperationsOperations, + EvaluatedMachinesOperationsOperations, + EvaluatedSqlEntitiesOperationsOperations, + EvaluatedWebAppsOperationsOperations, + GroupsOperationsOperations, + HypervCollectorsOperationsOperations, + ImportCollectorsOperationsOperations, + MachinesOperationsOperations, + Operations, + PrivateEndpointConnectionOperationsOperations, + PrivateLinkResourceOperationsOperations, + ServerCollectorsOperationsOperations, + SqlAssessmentOptionsOperationsOperations, + SqlAssessmentV2OperationsOperations, + SqlAssessmentV2SummaryOperationsOperations, + SqlCollectorOperationsOperations, + VmwareCollectorsOperationsOperations, + WebAppAssessmentOptionsOperationsOperations, + WebAppAssessmentV2OperationsOperations, + WebAppAssessmentV2SummaryOperationsOperations, + WebAppCollectorOperationsOperations, + WebAppServicePlanV2OperationsOperations, +) + +if TYPE_CHECKING: + from azure.core.credentials import TokenCredential + + +class AzureMigrateAssessmentService: # pylint: disable=too-many-instance-attributes + """Azure Migrate Resource Provider management API. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.migrationassessment.operations.Operations + :ivar assessment_projects_operations: AssessmentProjectsOperationsOperations operations + :vartype assessment_projects_operations: + azure.mgmt.migrationassessment.operations.AssessmentProjectsOperationsOperations + :ivar aks_options_operations: AksOptionsOperationsOperations operations + :vartype aks_options_operations: + azure.mgmt.migrationassessment.operations.AksOptionsOperationsOperations + :ivar aks_assessment_operations: AksAssessmentOperationsOperations operations + :vartype aks_assessment_operations: + azure.mgmt.migrationassessment.operations.AksAssessmentOperationsOperations + :ivar assessed_web_application_operations: AssessedWebApplicationOperationsOperations + operations + :vartype assessed_web_application_operations: + azure.mgmt.migrationassessment.operations.AssessedWebApplicationOperationsOperations + :ivar aks_cluster_operations: AksClusterOperationsOperations operations + :vartype aks_cluster_operations: + azure.mgmt.migrationassessment.operations.AksClusterOperationsOperations + :ivar aks_cost_detail_operations: AksCostDetailOperationsOperations operations + :vartype aks_cost_detail_operations: + azure.mgmt.migrationassessment.operations.AksCostDetailOperationsOperations + :ivar aks_summary_operations: AksSummaryOperationsOperations operations + :vartype aks_summary_operations: + azure.mgmt.migrationassessment.operations.AksSummaryOperationsOperations + :ivar assessment_options_operations: AssessmentOptionsOperationsOperations operations + :vartype assessment_options_operations: + azure.mgmt.migrationassessment.operations.AssessmentOptionsOperationsOperations + :ivar avs_assessment_options_operations: AvsAssessmentOptionsOperationsOperations operations + :vartype avs_assessment_options_operations: + azure.mgmt.migrationassessment.operations.AvsAssessmentOptionsOperationsOperations + :ivar business_case_operations: BusinessCaseOperationsOperations operations + :vartype business_case_operations: + azure.mgmt.migrationassessment.operations.BusinessCaseOperationsOperations + :ivar business_case_avs_summary_operations: BusinessCaseAvsSummaryOperationsOperations + operations + :vartype business_case_avs_summary_operations: + azure.mgmt.migrationassessment.operations.BusinessCaseAvsSummaryOperationsOperations + :ivar evaluated_avs_machines_operations: EvaluatedAvsMachinesOperationsOperations operations + :vartype evaluated_avs_machines_operations: + azure.mgmt.migrationassessment.operations.EvaluatedAvsMachinesOperationsOperations + :ivar evaluated_machines_operations: EvaluatedMachinesOperationsOperations operations + :vartype evaluated_machines_operations: + azure.mgmt.migrationassessment.operations.EvaluatedMachinesOperationsOperations + :ivar evaluated_sql_entities_operations: EvaluatedSqlEntitiesOperationsOperations operations + :vartype evaluated_sql_entities_operations: + azure.mgmt.migrationassessment.operations.EvaluatedSqlEntitiesOperationsOperations + :ivar evaluated_web_apps_operations: EvaluatedWebAppsOperationsOperations operations + :vartype evaluated_web_apps_operations: + azure.mgmt.migrationassessment.operations.EvaluatedWebAppsOperationsOperations + :ivar business_case_iaas_summary_operations: BusinessCaseIaasSummaryOperationsOperations + operations + :vartype business_case_iaas_summary_operations: + azure.mgmt.migrationassessment.operations.BusinessCaseIaasSummaryOperationsOperations + :ivar business_case_overview_summary_operations: + BusinessCaseOverviewSummaryOperationsOperations operations + :vartype business_case_overview_summary_operations: + azure.mgmt.migrationassessment.operations.BusinessCaseOverviewSummaryOperationsOperations + :ivar business_case_paas_summary_operations: BusinessCasePaasSummaryOperationsOperations + operations + :vartype business_case_paas_summary_operations: + azure.mgmt.migrationassessment.operations.BusinessCasePaasSummaryOperationsOperations + :ivar groups_operations: GroupsOperationsOperations operations + :vartype groups_operations: + azure.mgmt.migrationassessment.operations.GroupsOperationsOperations + :ivar assessments_operations: AssessmentsOperationsOperations operations + :vartype assessments_operations: + azure.mgmt.migrationassessment.operations.AssessmentsOperationsOperations + :ivar assessed_machines_operations: AssessedMachinesOperationsOperations operations + :vartype assessed_machines_operations: + azure.mgmt.migrationassessment.operations.AssessedMachinesOperationsOperations + :ivar avs_assessments_operations: AvsAssessmentsOperationsOperations operations + :vartype avs_assessments_operations: + azure.mgmt.migrationassessment.operations.AvsAssessmentsOperationsOperations + :ivar avs_assessed_machines_operations: AvsAssessedMachinesOperationsOperations operations + :vartype avs_assessed_machines_operations: + azure.mgmt.migrationassessment.operations.AvsAssessedMachinesOperationsOperations + :ivar sql_assessment_v2_operations: SqlAssessmentV2OperationsOperations operations + :vartype sql_assessment_v2_operations: + azure.mgmt.migrationassessment.operations.SqlAssessmentV2OperationsOperations + :ivar assessed_sql_database_v2_operations: AssessedSqlDatabaseV2OperationsOperations operations + :vartype assessed_sql_database_v2_operations: + azure.mgmt.migrationassessment.operations.AssessedSqlDatabaseV2OperationsOperations + :ivar assessed_sql_instance_v2_operations: AssessedSqlInstanceV2OperationsOperations operations + :vartype assessed_sql_instance_v2_operations: + azure.mgmt.migrationassessment.operations.AssessedSqlInstanceV2OperationsOperations + :ivar assessed_sql_machines_operations: AssessedSqlMachinesOperationsOperations operations + :vartype assessed_sql_machines_operations: + azure.mgmt.migrationassessment.operations.AssessedSqlMachinesOperationsOperations + :ivar assessed_sql_recommended_entity_operations: + AssessedSqlRecommendedEntityOperationsOperations operations + :vartype assessed_sql_recommended_entity_operations: + azure.mgmt.migrationassessment.operations.AssessedSqlRecommendedEntityOperationsOperations + :ivar sql_assessment_v2_summary_operations: SqlAssessmentV2SummaryOperationsOperations + operations + :vartype sql_assessment_v2_summary_operations: + azure.mgmt.migrationassessment.operations.SqlAssessmentV2SummaryOperationsOperations + :ivar web_app_assessment_v2_operations: WebAppAssessmentV2OperationsOperations operations + :vartype web_app_assessment_v2_operations: + azure.mgmt.migrationassessment.operations.WebAppAssessmentV2OperationsOperations + :ivar assessed_web_app_v2_operations: AssessedWebAppV2OperationsOperations operations + :vartype assessed_web_app_v2_operations: + azure.mgmt.migrationassessment.operations.AssessedWebAppV2OperationsOperations + :ivar web_app_assessment_v2_summary_operations: WebAppAssessmentV2SummaryOperationsOperations + operations + :vartype web_app_assessment_v2_summary_operations: + azure.mgmt.migrationassessment.operations.WebAppAssessmentV2SummaryOperationsOperations + :ivar web_app_service_plan_v2_operations: WebAppServicePlanV2OperationsOperations operations + :vartype web_app_service_plan_v2_operations: + azure.mgmt.migrationassessment.operations.WebAppServicePlanV2OperationsOperations + :ivar hyperv_collectors_operations: HypervCollectorsOperationsOperations operations + :vartype hyperv_collectors_operations: + azure.mgmt.migrationassessment.operations.HypervCollectorsOperationsOperations + :ivar import_collectors_operations: ImportCollectorsOperationsOperations operations + :vartype import_collectors_operations: + azure.mgmt.migrationassessment.operations.ImportCollectorsOperationsOperations + :ivar machines_operations: MachinesOperationsOperations operations + :vartype machines_operations: + azure.mgmt.migrationassessment.operations.MachinesOperationsOperations + :ivar private_endpoint_connection_operations: PrivateEndpointConnectionOperationsOperations + operations + :vartype private_endpoint_connection_operations: + azure.mgmt.migrationassessment.operations.PrivateEndpointConnectionOperationsOperations + :ivar private_link_resource_operations: PrivateLinkResourceOperationsOperations operations + :vartype private_link_resource_operations: + azure.mgmt.migrationassessment.operations.PrivateLinkResourceOperationsOperations + :ivar assessment_project_summary_operations: AssessmentProjectSummaryOperationsOperations + operations + :vartype assessment_project_summary_operations: + azure.mgmt.migrationassessment.operations.AssessmentProjectSummaryOperationsOperations + :ivar server_collectors_operations: ServerCollectorsOperationsOperations operations + :vartype server_collectors_operations: + azure.mgmt.migrationassessment.operations.ServerCollectorsOperationsOperations + :ivar sql_assessment_options_operations: SqlAssessmentOptionsOperationsOperations operations + :vartype sql_assessment_options_operations: + azure.mgmt.migrationassessment.operations.SqlAssessmentOptionsOperationsOperations + :ivar sql_collector_operations: SqlCollectorOperationsOperations operations + :vartype sql_collector_operations: + azure.mgmt.migrationassessment.operations.SqlCollectorOperationsOperations + :ivar vmware_collectors_operations: VmwareCollectorsOperationsOperations operations + :vartype vmware_collectors_operations: + azure.mgmt.migrationassessment.operations.VmwareCollectorsOperationsOperations + :ivar web_app_assessment_options_operations: WebAppAssessmentOptionsOperationsOperations + operations + :vartype web_app_assessment_options_operations: + azure.mgmt.migrationassessment.operations.WebAppAssessmentOptionsOperationsOperations + :ivar web_app_collector_operations: WebAppCollectorOperationsOperations operations + :vartype web_app_collector_operations: + azure.mgmt.migrationassessment.operations.WebAppCollectorOperationsOperations + :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-01-01-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__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AzureMigrateAssessmentServiceConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.assessment_projects_operations = AssessmentProjectsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.aks_options_operations = AksOptionsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.aks_assessment_operations = AksAssessmentOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.assessed_web_application_operations = AssessedWebApplicationOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.aks_cluster_operations = AksClusterOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.aks_cost_detail_operations = AksCostDetailOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.aks_summary_operations = AksSummaryOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.assessment_options_operations = AssessmentOptionsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.avs_assessment_options_operations = AvsAssessmentOptionsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.business_case_operations = BusinessCaseOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.business_case_avs_summary_operations = BusinessCaseAvsSummaryOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.evaluated_avs_machines_operations = EvaluatedAvsMachinesOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.evaluated_machines_operations = EvaluatedMachinesOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.evaluated_sql_entities_operations = EvaluatedSqlEntitiesOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.evaluated_web_apps_operations = EvaluatedWebAppsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.business_case_iaas_summary_operations = BusinessCaseIaasSummaryOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.business_case_overview_summary_operations = BusinessCaseOverviewSummaryOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.business_case_paas_summary_operations = BusinessCasePaasSummaryOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.groups_operations = GroupsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.assessments_operations = AssessmentsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.assessed_machines_operations = AssessedMachinesOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.avs_assessments_operations = AvsAssessmentsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.avs_assessed_machines_operations = AvsAssessedMachinesOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sql_assessment_v2_operations = SqlAssessmentV2OperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.assessed_sql_database_v2_operations = AssessedSqlDatabaseV2OperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.assessed_sql_instance_v2_operations = AssessedSqlInstanceV2OperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.assessed_sql_machines_operations = AssessedSqlMachinesOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.assessed_sql_recommended_entity_operations = AssessedSqlRecommendedEntityOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sql_assessment_v2_summary_operations = SqlAssessmentV2SummaryOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.web_app_assessment_v2_operations = WebAppAssessmentV2OperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.assessed_web_app_v2_operations = AssessedWebAppV2OperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.web_app_assessment_v2_summary_operations = WebAppAssessmentV2SummaryOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.web_app_service_plan_v2_operations = WebAppServicePlanV2OperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.hyperv_collectors_operations = HypervCollectorsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.import_collectors_operations = ImportCollectorsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.machines_operations = MachinesOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connection_operations = PrivateEndpointConnectionOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resource_operations = PrivateLinkResourceOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.assessment_project_summary_operations = AssessmentProjectSummaryOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.server_collectors_operations = ServerCollectorsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sql_assessment_options_operations = SqlAssessmentOptionsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sql_collector_operations = SqlCollectorOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.vmware_collectors_operations = VmwareCollectorsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.web_app_assessment_options_operations = WebAppAssessmentOptionsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.web_app_collector_operations = WebAppCollectorOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> Self: + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/_configuration.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/_configuration.py new file mode 100644 index 000000000000..f4c054204910 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/_configuration.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + from azure.core.credentials import TokenCredential + + +class AzureMigrateAssessmentServiceConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for AzureMigrateAssessmentService. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :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-01-01-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-01-01-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-migrationassessment/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/_patch.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/_serialization.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/_serialization.py new file mode 100644 index 000000000000..b24ab2885450 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/_serialization.py @@ -0,0 +1,2118 @@ +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore + +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :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 + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) from err + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError as err: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + 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 + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0. + + :param datetime.datetime dt: The datetime + :returns: The offset + :rtype: datetime.timedelta + """ + return datetime.timedelta(0) + + def tzname(self, dt): + """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. + + :param datetime.datetime dt: The datetime + :returns: The daylight saving time + :rtype: datetime.timedelta + """ + return datetime.timedelta(hours=1) + + +try: + from datetime import timezone as _FixedOffset # type: ignore +except ImportError: # Python 2.7 + + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset) -> None: + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds() / 3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + + +try: + from datetime import timezone + + TZ_UTC = timezone.utc +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Optional[Dict[str, Any]] = {} + 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): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """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. + + :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: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to server from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + 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 + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + 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( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + 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: # pylint: disable=broad-exception-caught + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + :rtype: ModelType + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + 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 + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + 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. + + :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.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: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + 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: # pylint: disable=too-many-public-methods + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + 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 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) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() # pylint: disable=protected-access + try: + 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( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + 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 "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError as err: + if isinstance(err, SerializationError): + raise + + 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 + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :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 + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + 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 + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :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 + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) + else: + output = quote(str(output), safe="") + 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 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. + :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 + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + 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 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]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(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 object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :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") + + try: + if data is CoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + if data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise SerializationError(msg.format(data, data_type)) from err + return self._serialize(data, **kwargs) + + @classmethod + 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 + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible 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 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 # 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 str data: Object to be serialized. + :rtype: str + :return: serialized object + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list data: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + Defaults to False. + :rtype: list, str + :return: serialized iterable + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized.append(None) + + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :rtype: dict + :return: serialized dictionary + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + 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 + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + :return: serialized object + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + if obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + 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)) from exc + + @staticmethod + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument + """Serialize bytearray into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument + """Serialize str into base-64 string. + + :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): # pylint: disable=unused-argument + """Serialize Decimal object to float. + + :param decimal attr: Object to be serialized. + :rtype: float + :return: serialized decimal + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument + """Serialize long (Py2) or int (Py3). + + :param int attr: Object to be serialized. + :rtype: int/long + :return: serialized long + """ + return _long_type(attr) + + @staticmethod + 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) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + 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) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + 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): # 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 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], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + 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) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise SerializationError(msg) from err + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise TypeError(msg) from err + + @staticmethod + 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 + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc + + +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +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): # 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) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + 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 + # 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. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer: + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + 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}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :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): # pylint: disable=inconsistent-return-statements + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :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(): # pylint: disable=protected-access + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, str): + return self.deserialize_data(data, response) + 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 # 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"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise DeserializationError(msg) from err + 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: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple + """ + if target is None: + return None, None + + if isinstance(target, str): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + 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 + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :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: # pylint: disable=bare-except + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :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", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :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() # 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 # 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)) from err + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) from exp + + 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 + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + 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) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise DeserializationError(msg) from err + 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: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :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): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + 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): # 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. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, str): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_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 + valid bool values. + + :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. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + # 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) + if isinstance(attr, str): + if attr.lower() in ["true", "1"]: + return True + 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 # pylint: disable=eval-used + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return 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, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :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: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + try: + return list(enum_obj.__members__.values())[data] + except IndexError as exc: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) from exc + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + 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. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + 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. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :return: Deserialized decimal + :raises: DeserializationError if string format invalid. + :rtype: decimal + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(str(attr)) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise DeserializationError(msg) from err + + @staticmethod + 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. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + 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. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + 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. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) + + @staticmethod + 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. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + 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. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise DeserializationError(msg) from err + 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. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :return: Deserialized datetime + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + attr = int(attr) + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise DeserializationError(msg) from err + return date_obj diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/_version.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/_version.py @@ -0,0 +1,9 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/__init__.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/__init__.py new file mode 100644 index 000000000000..db54621aae99 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/__init__.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._azure_migrate_assessment_service import AzureMigrateAssessmentService # type: ignore + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AzureMigrateAssessmentService", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/_azure_migrate_assessment_service.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/_azure_migrate_assessment_service.py new file mode 100644 index 000000000000..7ad8d0edf95c --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/_azure_migrate_assessment_service.py @@ -0,0 +1,441 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy + +from .. import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import AzureMigrateAssessmentServiceConfiguration +from .operations import ( + AksAssessmentOperationsOperations, + AksClusterOperationsOperations, + AksCostDetailOperationsOperations, + AksOptionsOperationsOperations, + AksSummaryOperationsOperations, + AssessedMachinesOperationsOperations, + AssessedSqlDatabaseV2OperationsOperations, + AssessedSqlInstanceV2OperationsOperations, + AssessedSqlMachinesOperationsOperations, + AssessedSqlRecommendedEntityOperationsOperations, + AssessedWebAppV2OperationsOperations, + AssessedWebApplicationOperationsOperations, + AssessmentOptionsOperationsOperations, + AssessmentProjectSummaryOperationsOperations, + AssessmentProjectsOperationsOperations, + AssessmentsOperationsOperations, + AvsAssessedMachinesOperationsOperations, + AvsAssessmentOptionsOperationsOperations, + AvsAssessmentsOperationsOperations, + BusinessCaseAvsSummaryOperationsOperations, + BusinessCaseIaasSummaryOperationsOperations, + BusinessCaseOperationsOperations, + BusinessCaseOverviewSummaryOperationsOperations, + BusinessCasePaasSummaryOperationsOperations, + EvaluatedAvsMachinesOperationsOperations, + EvaluatedMachinesOperationsOperations, + EvaluatedSqlEntitiesOperationsOperations, + EvaluatedWebAppsOperationsOperations, + GroupsOperationsOperations, + HypervCollectorsOperationsOperations, + ImportCollectorsOperationsOperations, + MachinesOperationsOperations, + Operations, + PrivateEndpointConnectionOperationsOperations, + PrivateLinkResourceOperationsOperations, + ServerCollectorsOperationsOperations, + SqlAssessmentOptionsOperationsOperations, + SqlAssessmentV2OperationsOperations, + SqlAssessmentV2SummaryOperationsOperations, + SqlCollectorOperationsOperations, + VmwareCollectorsOperationsOperations, + WebAppAssessmentOptionsOperationsOperations, + WebAppAssessmentV2OperationsOperations, + WebAppAssessmentV2SummaryOperationsOperations, + WebAppCollectorOperationsOperations, + WebAppServicePlanV2OperationsOperations, +) + +if TYPE_CHECKING: + from azure.core.credentials_async import AsyncTokenCredential + + +class AzureMigrateAssessmentService: # pylint: disable=too-many-instance-attributes + """Azure Migrate Resource Provider management API. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.migrationassessment.aio.operations.Operations + :ivar assessment_projects_operations: AssessmentProjectsOperationsOperations operations + :vartype assessment_projects_operations: + azure.mgmt.migrationassessment.aio.operations.AssessmentProjectsOperationsOperations + :ivar aks_options_operations: AksOptionsOperationsOperations operations + :vartype aks_options_operations: + azure.mgmt.migrationassessment.aio.operations.AksOptionsOperationsOperations + :ivar aks_assessment_operations: AksAssessmentOperationsOperations operations + :vartype aks_assessment_operations: + azure.mgmt.migrationassessment.aio.operations.AksAssessmentOperationsOperations + :ivar assessed_web_application_operations: AssessedWebApplicationOperationsOperations + operations + :vartype assessed_web_application_operations: + azure.mgmt.migrationassessment.aio.operations.AssessedWebApplicationOperationsOperations + :ivar aks_cluster_operations: AksClusterOperationsOperations operations + :vartype aks_cluster_operations: + azure.mgmt.migrationassessment.aio.operations.AksClusterOperationsOperations + :ivar aks_cost_detail_operations: AksCostDetailOperationsOperations operations + :vartype aks_cost_detail_operations: + azure.mgmt.migrationassessment.aio.operations.AksCostDetailOperationsOperations + :ivar aks_summary_operations: AksSummaryOperationsOperations operations + :vartype aks_summary_operations: + azure.mgmt.migrationassessment.aio.operations.AksSummaryOperationsOperations + :ivar assessment_options_operations: AssessmentOptionsOperationsOperations operations + :vartype assessment_options_operations: + azure.mgmt.migrationassessment.aio.operations.AssessmentOptionsOperationsOperations + :ivar avs_assessment_options_operations: AvsAssessmentOptionsOperationsOperations operations + :vartype avs_assessment_options_operations: + azure.mgmt.migrationassessment.aio.operations.AvsAssessmentOptionsOperationsOperations + :ivar business_case_operations: BusinessCaseOperationsOperations operations + :vartype business_case_operations: + azure.mgmt.migrationassessment.aio.operations.BusinessCaseOperationsOperations + :ivar business_case_avs_summary_operations: BusinessCaseAvsSummaryOperationsOperations + operations + :vartype business_case_avs_summary_operations: + azure.mgmt.migrationassessment.aio.operations.BusinessCaseAvsSummaryOperationsOperations + :ivar evaluated_avs_machines_operations: EvaluatedAvsMachinesOperationsOperations operations + :vartype evaluated_avs_machines_operations: + azure.mgmt.migrationassessment.aio.operations.EvaluatedAvsMachinesOperationsOperations + :ivar evaluated_machines_operations: EvaluatedMachinesOperationsOperations operations + :vartype evaluated_machines_operations: + azure.mgmt.migrationassessment.aio.operations.EvaluatedMachinesOperationsOperations + :ivar evaluated_sql_entities_operations: EvaluatedSqlEntitiesOperationsOperations operations + :vartype evaluated_sql_entities_operations: + azure.mgmt.migrationassessment.aio.operations.EvaluatedSqlEntitiesOperationsOperations + :ivar evaluated_web_apps_operations: EvaluatedWebAppsOperationsOperations operations + :vartype evaluated_web_apps_operations: + azure.mgmt.migrationassessment.aio.operations.EvaluatedWebAppsOperationsOperations + :ivar business_case_iaas_summary_operations: BusinessCaseIaasSummaryOperationsOperations + operations + :vartype business_case_iaas_summary_operations: + azure.mgmt.migrationassessment.aio.operations.BusinessCaseIaasSummaryOperationsOperations + :ivar business_case_overview_summary_operations: + BusinessCaseOverviewSummaryOperationsOperations operations + :vartype business_case_overview_summary_operations: + azure.mgmt.migrationassessment.aio.operations.BusinessCaseOverviewSummaryOperationsOperations + :ivar business_case_paas_summary_operations: BusinessCasePaasSummaryOperationsOperations + operations + :vartype business_case_paas_summary_operations: + azure.mgmt.migrationassessment.aio.operations.BusinessCasePaasSummaryOperationsOperations + :ivar groups_operations: GroupsOperationsOperations operations + :vartype groups_operations: + azure.mgmt.migrationassessment.aio.operations.GroupsOperationsOperations + :ivar assessments_operations: AssessmentsOperationsOperations operations + :vartype assessments_operations: + azure.mgmt.migrationassessment.aio.operations.AssessmentsOperationsOperations + :ivar assessed_machines_operations: AssessedMachinesOperationsOperations operations + :vartype assessed_machines_operations: + azure.mgmt.migrationassessment.aio.operations.AssessedMachinesOperationsOperations + :ivar avs_assessments_operations: AvsAssessmentsOperationsOperations operations + :vartype avs_assessments_operations: + azure.mgmt.migrationassessment.aio.operations.AvsAssessmentsOperationsOperations + :ivar avs_assessed_machines_operations: AvsAssessedMachinesOperationsOperations operations + :vartype avs_assessed_machines_operations: + azure.mgmt.migrationassessment.aio.operations.AvsAssessedMachinesOperationsOperations + :ivar sql_assessment_v2_operations: SqlAssessmentV2OperationsOperations operations + :vartype sql_assessment_v2_operations: + azure.mgmt.migrationassessment.aio.operations.SqlAssessmentV2OperationsOperations + :ivar assessed_sql_database_v2_operations: AssessedSqlDatabaseV2OperationsOperations operations + :vartype assessed_sql_database_v2_operations: + azure.mgmt.migrationassessment.aio.operations.AssessedSqlDatabaseV2OperationsOperations + :ivar assessed_sql_instance_v2_operations: AssessedSqlInstanceV2OperationsOperations operations + :vartype assessed_sql_instance_v2_operations: + azure.mgmt.migrationassessment.aio.operations.AssessedSqlInstanceV2OperationsOperations + :ivar assessed_sql_machines_operations: AssessedSqlMachinesOperationsOperations operations + :vartype assessed_sql_machines_operations: + azure.mgmt.migrationassessment.aio.operations.AssessedSqlMachinesOperationsOperations + :ivar assessed_sql_recommended_entity_operations: + AssessedSqlRecommendedEntityOperationsOperations operations + :vartype assessed_sql_recommended_entity_operations: + azure.mgmt.migrationassessment.aio.operations.AssessedSqlRecommendedEntityOperationsOperations + :ivar sql_assessment_v2_summary_operations: SqlAssessmentV2SummaryOperationsOperations + operations + :vartype sql_assessment_v2_summary_operations: + azure.mgmt.migrationassessment.aio.operations.SqlAssessmentV2SummaryOperationsOperations + :ivar web_app_assessment_v2_operations: WebAppAssessmentV2OperationsOperations operations + :vartype web_app_assessment_v2_operations: + azure.mgmt.migrationassessment.aio.operations.WebAppAssessmentV2OperationsOperations + :ivar assessed_web_app_v2_operations: AssessedWebAppV2OperationsOperations operations + :vartype assessed_web_app_v2_operations: + azure.mgmt.migrationassessment.aio.operations.AssessedWebAppV2OperationsOperations + :ivar web_app_assessment_v2_summary_operations: WebAppAssessmentV2SummaryOperationsOperations + operations + :vartype web_app_assessment_v2_summary_operations: + azure.mgmt.migrationassessment.aio.operations.WebAppAssessmentV2SummaryOperationsOperations + :ivar web_app_service_plan_v2_operations: WebAppServicePlanV2OperationsOperations operations + :vartype web_app_service_plan_v2_operations: + azure.mgmt.migrationassessment.aio.operations.WebAppServicePlanV2OperationsOperations + :ivar hyperv_collectors_operations: HypervCollectorsOperationsOperations operations + :vartype hyperv_collectors_operations: + azure.mgmt.migrationassessment.aio.operations.HypervCollectorsOperationsOperations + :ivar import_collectors_operations: ImportCollectorsOperationsOperations operations + :vartype import_collectors_operations: + azure.mgmt.migrationassessment.aio.operations.ImportCollectorsOperationsOperations + :ivar machines_operations: MachinesOperationsOperations operations + :vartype machines_operations: + azure.mgmt.migrationassessment.aio.operations.MachinesOperationsOperations + :ivar private_endpoint_connection_operations: PrivateEndpointConnectionOperationsOperations + operations + :vartype private_endpoint_connection_operations: + azure.mgmt.migrationassessment.aio.operations.PrivateEndpointConnectionOperationsOperations + :ivar private_link_resource_operations: PrivateLinkResourceOperationsOperations operations + :vartype private_link_resource_operations: + azure.mgmt.migrationassessment.aio.operations.PrivateLinkResourceOperationsOperations + :ivar assessment_project_summary_operations: AssessmentProjectSummaryOperationsOperations + operations + :vartype assessment_project_summary_operations: + azure.mgmt.migrationassessment.aio.operations.AssessmentProjectSummaryOperationsOperations + :ivar server_collectors_operations: ServerCollectorsOperationsOperations operations + :vartype server_collectors_operations: + azure.mgmt.migrationassessment.aio.operations.ServerCollectorsOperationsOperations + :ivar sql_assessment_options_operations: SqlAssessmentOptionsOperationsOperations operations + :vartype sql_assessment_options_operations: + azure.mgmt.migrationassessment.aio.operations.SqlAssessmentOptionsOperationsOperations + :ivar sql_collector_operations: SqlCollectorOperationsOperations operations + :vartype sql_collector_operations: + azure.mgmt.migrationassessment.aio.operations.SqlCollectorOperationsOperations + :ivar vmware_collectors_operations: VmwareCollectorsOperationsOperations operations + :vartype vmware_collectors_operations: + azure.mgmt.migrationassessment.aio.operations.VmwareCollectorsOperationsOperations + :ivar web_app_assessment_options_operations: WebAppAssessmentOptionsOperationsOperations + operations + :vartype web_app_assessment_options_operations: + azure.mgmt.migrationassessment.aio.operations.WebAppAssessmentOptionsOperationsOperations + :ivar web_app_collector_operations: WebAppCollectorOperationsOperations operations + :vartype web_app_collector_operations: + azure.mgmt.migrationassessment.aio.operations.WebAppCollectorOperationsOperations + :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-01-01-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__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AzureMigrateAssessmentServiceConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.assessment_projects_operations = AssessmentProjectsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.aks_options_operations = AksOptionsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.aks_assessment_operations = AksAssessmentOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.assessed_web_application_operations = AssessedWebApplicationOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.aks_cluster_operations = AksClusterOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.aks_cost_detail_operations = AksCostDetailOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.aks_summary_operations = AksSummaryOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.assessment_options_operations = AssessmentOptionsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.avs_assessment_options_operations = AvsAssessmentOptionsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.business_case_operations = BusinessCaseOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.business_case_avs_summary_operations = BusinessCaseAvsSummaryOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.evaluated_avs_machines_operations = EvaluatedAvsMachinesOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.evaluated_machines_operations = EvaluatedMachinesOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.evaluated_sql_entities_operations = EvaluatedSqlEntitiesOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.evaluated_web_apps_operations = EvaluatedWebAppsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.business_case_iaas_summary_operations = BusinessCaseIaasSummaryOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.business_case_overview_summary_operations = BusinessCaseOverviewSummaryOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.business_case_paas_summary_operations = BusinessCasePaasSummaryOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.groups_operations = GroupsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.assessments_operations = AssessmentsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.assessed_machines_operations = AssessedMachinesOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.avs_assessments_operations = AvsAssessmentsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.avs_assessed_machines_operations = AvsAssessedMachinesOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sql_assessment_v2_operations = SqlAssessmentV2OperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.assessed_sql_database_v2_operations = AssessedSqlDatabaseV2OperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.assessed_sql_instance_v2_operations = AssessedSqlInstanceV2OperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.assessed_sql_machines_operations = AssessedSqlMachinesOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.assessed_sql_recommended_entity_operations = AssessedSqlRecommendedEntityOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sql_assessment_v2_summary_operations = SqlAssessmentV2SummaryOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.web_app_assessment_v2_operations = WebAppAssessmentV2OperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.assessed_web_app_v2_operations = AssessedWebAppV2OperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.web_app_assessment_v2_summary_operations = WebAppAssessmentV2SummaryOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.web_app_service_plan_v2_operations = WebAppServicePlanV2OperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.hyperv_collectors_operations = HypervCollectorsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.import_collectors_operations = ImportCollectorsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.machines_operations = MachinesOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connection_operations = PrivateEndpointConnectionOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resource_operations = PrivateLinkResourceOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.assessment_project_summary_operations = AssessmentProjectSummaryOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.server_collectors_operations = ServerCollectorsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sql_assessment_options_operations = SqlAssessmentOptionsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sql_collector_operations = SqlCollectorOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.vmware_collectors_operations = VmwareCollectorsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.web_app_assessment_options_operations = WebAppAssessmentOptionsOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.web_app_collector_operations = WebAppCollectorOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> Self: + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/_configuration.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/_configuration.py new file mode 100644 index 000000000000..ca8b86bc934f --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/_configuration.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + from azure.core.credentials_async import AsyncTokenCredential + + +class AzureMigrateAssessmentServiceConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for AzureMigrateAssessmentService. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :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-01-01-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-01-01-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-migrationassessment/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/_patch.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/__init__.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/__init__.py new file mode 100644 index 000000000000..4066858e9b1d --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/__init__.py @@ -0,0 +1,115 @@ +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._assessment_projects_operations_operations import AssessmentProjectsOperationsOperations # type: ignore +from ._aks_options_operations_operations import AksOptionsOperationsOperations # type: ignore +from ._aks_assessment_operations_operations import AksAssessmentOperationsOperations # type: ignore +from ._assessed_web_application_operations_operations import AssessedWebApplicationOperationsOperations # type: ignore +from ._aks_cluster_operations_operations import AksClusterOperationsOperations # type: ignore +from ._aks_cost_detail_operations_operations import AksCostDetailOperationsOperations # type: ignore +from ._aks_summary_operations_operations import AksSummaryOperationsOperations # type: ignore +from ._assessment_options_operations_operations import AssessmentOptionsOperationsOperations # type: ignore +from ._avs_assessment_options_operations_operations import AvsAssessmentOptionsOperationsOperations # type: ignore +from ._business_case_operations_operations import BusinessCaseOperationsOperations # type: ignore +from ._business_case_avs_summary_operations_operations import BusinessCaseAvsSummaryOperationsOperations # type: ignore +from ._evaluated_avs_machines_operations_operations import EvaluatedAvsMachinesOperationsOperations # type: ignore +from ._evaluated_machines_operations_operations import EvaluatedMachinesOperationsOperations # type: ignore +from ._evaluated_sql_entities_operations_operations import EvaluatedSqlEntitiesOperationsOperations # type: ignore +from ._evaluated_web_apps_operations_operations import EvaluatedWebAppsOperationsOperations # type: ignore +from ._business_case_iaas_summary_operations_operations import BusinessCaseIaasSummaryOperationsOperations # type: ignore +from ._business_case_overview_summary_operations_operations import BusinessCaseOverviewSummaryOperationsOperations # type: ignore +from ._business_case_paas_summary_operations_operations import BusinessCasePaasSummaryOperationsOperations # type: ignore +from ._groups_operations_operations import GroupsOperationsOperations # type: ignore +from ._assessments_operations_operations import AssessmentsOperationsOperations # type: ignore +from ._assessed_machines_operations_operations import AssessedMachinesOperationsOperations # type: ignore +from ._avs_assessments_operations_operations import AvsAssessmentsOperationsOperations # type: ignore +from ._avs_assessed_machines_operations_operations import AvsAssessedMachinesOperationsOperations # type: ignore +from ._sql_assessment_v2_operations_operations import SqlAssessmentV2OperationsOperations # type: ignore +from ._assessed_sql_database_v2_operations_operations import AssessedSqlDatabaseV2OperationsOperations # type: ignore +from ._assessed_sql_instance_v2_operations_operations import AssessedSqlInstanceV2OperationsOperations # type: ignore +from ._assessed_sql_machines_operations_operations import AssessedSqlMachinesOperationsOperations # type: ignore +from ._assessed_sql_recommended_entity_operations_operations import AssessedSqlRecommendedEntityOperationsOperations # type: ignore +from ._sql_assessment_v2_summary_operations_operations import SqlAssessmentV2SummaryOperationsOperations # type: ignore +from ._web_app_assessment_v2_operations_operations import WebAppAssessmentV2OperationsOperations # type: ignore +from ._assessed_web_app_v2_operations_operations import AssessedWebAppV2OperationsOperations # type: ignore +from ._web_app_assessment_v2_summary_operations_operations import WebAppAssessmentV2SummaryOperationsOperations # type: ignore +from ._web_app_service_plan_v2_operations_operations import WebAppServicePlanV2OperationsOperations # type: ignore +from ._hyperv_collectors_operations_operations import HypervCollectorsOperationsOperations # type: ignore +from ._import_collectors_operations_operations import ImportCollectorsOperationsOperations # type: ignore +from ._machines_operations_operations import MachinesOperationsOperations # type: ignore +from ._private_endpoint_connection_operations_operations import PrivateEndpointConnectionOperationsOperations # type: ignore +from ._private_link_resource_operations_operations import PrivateLinkResourceOperationsOperations # type: ignore +from ._assessment_project_summary_operations_operations import AssessmentProjectSummaryOperationsOperations # type: ignore +from ._server_collectors_operations_operations import ServerCollectorsOperationsOperations # type: ignore +from ._sql_assessment_options_operations_operations import SqlAssessmentOptionsOperationsOperations # type: ignore +from ._sql_collector_operations_operations import SqlCollectorOperationsOperations # type: ignore +from ._vmware_collectors_operations_operations import VmwareCollectorsOperationsOperations # type: ignore +from ._web_app_assessment_options_operations_operations import WebAppAssessmentOptionsOperationsOperations # type: ignore +from ._web_app_collector_operations_operations import WebAppCollectorOperationsOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "Operations", + "AssessmentProjectsOperationsOperations", + "AksOptionsOperationsOperations", + "AksAssessmentOperationsOperations", + "AssessedWebApplicationOperationsOperations", + "AksClusterOperationsOperations", + "AksCostDetailOperationsOperations", + "AksSummaryOperationsOperations", + "AssessmentOptionsOperationsOperations", + "AvsAssessmentOptionsOperationsOperations", + "BusinessCaseOperationsOperations", + "BusinessCaseAvsSummaryOperationsOperations", + "EvaluatedAvsMachinesOperationsOperations", + "EvaluatedMachinesOperationsOperations", + "EvaluatedSqlEntitiesOperationsOperations", + "EvaluatedWebAppsOperationsOperations", + "BusinessCaseIaasSummaryOperationsOperations", + "BusinessCaseOverviewSummaryOperationsOperations", + "BusinessCasePaasSummaryOperationsOperations", + "GroupsOperationsOperations", + "AssessmentsOperationsOperations", + "AssessedMachinesOperationsOperations", + "AvsAssessmentsOperationsOperations", + "AvsAssessedMachinesOperationsOperations", + "SqlAssessmentV2OperationsOperations", + "AssessedSqlDatabaseV2OperationsOperations", + "AssessedSqlInstanceV2OperationsOperations", + "AssessedSqlMachinesOperationsOperations", + "AssessedSqlRecommendedEntityOperationsOperations", + "SqlAssessmentV2SummaryOperationsOperations", + "WebAppAssessmentV2OperationsOperations", + "AssessedWebAppV2OperationsOperations", + "WebAppAssessmentV2SummaryOperationsOperations", + "WebAppServicePlanV2OperationsOperations", + "HypervCollectorsOperationsOperations", + "ImportCollectorsOperationsOperations", + "MachinesOperationsOperations", + "PrivateEndpointConnectionOperationsOperations", + "PrivateLinkResourceOperationsOperations", + "AssessmentProjectSummaryOperationsOperations", + "ServerCollectorsOperationsOperations", + "SqlAssessmentOptionsOperationsOperations", + "SqlCollectorOperationsOperations", + "VmwareCollectorsOperationsOperations", + "WebAppAssessmentOptionsOperationsOperations", + "WebAppCollectorOperationsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_aks_assessment_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_aks_assessment_operations_operations.py new file mode 100644 index 000000000000..f3c87b74d458 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_aks_assessment_operations_operations.py @@ -0,0 +1,635 @@ +# 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._aks_assessment_operations_operations import ( + build_create_request, + build_delete_request, + build_download_url_request, + build_get_request, + build_list_by_assessment_project_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AksAssessmentOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`aks_assessment_operations` 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_assessment_project( + self, + resource_group_name: str, + project_name: str, + continuation_token_parameter: Optional[str] = None, + top: Optional[int] = None, + filter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.AKSAssessment"]: + """List AKSAssessment resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param continuation_token_parameter: Continuation Token Query Parameter. Default value is None. + :type continuation_token_parameter: str + :param top: Page Size Query Parameter. Default value is None. + :type top: int + :param filter: Filter Query Parameter. Default value is None. + :type filter: str + :param total_record_count: Total Record Count Query Parameter. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either AKSAssessment or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.AKSAssessment] + :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.AKSAssessmentListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + continuation_token_parameter=continuation_token_parameter, + top=top, + filter=filter, + total_record_count=total_record_count, + 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("AKSAssessmentListResult", 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, project_name: str, assessment_name: str, **kwargs: Any + ) -> _models.AKSAssessment: + """Get a AKSAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_name: str + :return: AKSAssessment or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AKSAssessment + :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.AKSAssessment] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_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("AKSAssessment", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + project_name: str, + assessment_name: str, + resource: Union[_models.AKSAssessment, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "AKSAssessment") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_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["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( + self, + resource_group_name: str, + project_name: str, + assessment_name: str, + resource: _models.AKSAssessment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AKSAssessment]: + """Create a AKSAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.AKSAssessment + :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 AKSAssessment or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.AKSAssessment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + project_name: str, + assessment_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AKSAssessment]: + """Create a AKSAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AKSAssessment or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.AKSAssessment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + project_name: str, + assessment_name: str, + resource: Union[_models.AKSAssessment, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.AKSAssessment]: + """Create a AKSAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Is either a AKSAssessment type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.migrationassessment.models.AKSAssessment or IO[bytes] + :return: An instance of AsyncLROPoller that returns either AKSAssessment or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.AKSAssessment] + :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.AKSAssessment] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_name, + resource=resource, + 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("AKSAssessment", 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.AKSAssessment].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AKSAssessment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def delete(self, resource_group_name: str, project_name: str, assessment_name: str, **kwargs: Any) -> None: + """Delete a AKSAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_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 + + async def _download_url_initial( + self, resource_group_name: str, project_name: str, assessment_name: str, body: JSON, **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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _json = self._serialize.body(body, "object") + + _request = build_download_url_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_download_url( + self, resource_group_name: str, project_name: str, assessment_name: str, body: JSON, **kwargs: Any + ) -> AsyncLROPoller[_models.DownloadUrl]: + """Get URL for downloading AKS Assessment Report. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_name: str + :param body: The content of the action request. Required. + :type body: JSON + :return: An instance of AsyncLROPoller that returns either DownloadUrl or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.DownloadUrl] + :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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.DownloadUrl] = 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._download_url_initial( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_name, + body=body, + 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("DownloadUrl", 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.DownloadUrl].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DownloadUrl]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_aks_cluster_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_aks_cluster_operations_operations.py new file mode 100644 index 000000000000..477f4c8e250a --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_aks_cluster_operations_operations.py @@ -0,0 +1,216 @@ +# 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._aks_cluster_operations_operations import build_get_request, build_list_by_aks_assessment_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 AksClusterOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`aks_cluster_operations` 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_aks_assessment( + self, + resource_group_name: str, + project_name: str, + assessment_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.AKSCluster"]: + """List AKSCluster resources by AKSAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_name: str + :param filter: Filter Query Parameter. Default value is None. + :type filter: str + :return: An iterator like instance of either AKSCluster or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.AKSCluster] + :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.AKSClusterListResult] = 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_aks_assessment_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_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("AKSClusterListResult", 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, project_name: str, assessment_name: str, cluster_name: str, **kwargs: Any + ) -> _models.AKSCluster: + """Get a AKSCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_name: str + :param cluster_name: AKS Cluster Name. Required. + :type cluster_name: str + :return: AKSCluster or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AKSCluster + :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.AKSCluster] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_name, + cluster_name=cluster_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("AKSCluster", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_aks_cost_detail_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_aks_cost_detail_operations_operations.py new file mode 100644 index 000000000000..9cc56822c32d --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_aks_cost_detail_operations_operations.py @@ -0,0 +1,151 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._aks_cost_detail_operations_operations import build_list_by_aks_assessment_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 AksCostDetailOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`aks_cost_detail_operations` 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_aks_assessment( + self, + resource_group_name: str, + project_name: str, + assessment_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.AKSCostDetail"]: + """List AKSCostDetail resources by AKSAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_name: str + :param filter: Filter Query Parameter. Default value is None. + :type filter: str + :return: An iterator like instance of either AKSCostDetail or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.AKSCostDetail] + :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.AKSCostDetailListResult] = 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_aks_assessment_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_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("AKSCostDetailListResult", 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/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_aks_options_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_aks_options_operations_operations.py new file mode 100644 index 000000000000..8e94fc6fc8bc --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_aks_options_operations_operations.py @@ -0,0 +1,203 @@ +# 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._aks_options_operations_operations import build_get_request, build_list_by_assessment_project_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 AksOptionsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`aks_options_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> AsyncIterable["_models.AKSAssessmentOptions"]: + """List AKSAssessmentOptions resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either AKSAssessmentOptions or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.AKSAssessmentOptions] + :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.AKSAssessmentOptionsListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("AKSAssessmentOptionsListResult", 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, project_name: str, assessment_options_name: str, **kwargs: Any + ) -> _models.AKSAssessmentOptions: + """Get a AKSAssessmentOptions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_options_name: AKS Assessment Options Name. Required. + :type assessment_options_name: str + :return: AKSAssessmentOptions or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AKSAssessmentOptions + :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.AKSAssessmentOptions] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_options_name=assessment_options_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("AKSAssessmentOptions", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_aks_summary_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_aks_summary_operations_operations.py new file mode 100644 index 000000000000..71c8bbe7c2a0 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_aks_summary_operations_operations.py @@ -0,0 +1,208 @@ +# 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._aks_summary_operations_operations import build_get_request, build_list_by_aks_assessment_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 AksSummaryOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`aks_summary_operations` 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_aks_assessment( + self, resource_group_name: str, project_name: str, assessment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.AKSSummary"]: + """List AKSSummary resources by AKSAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_name: str + :return: An iterator like instance of either AKSSummary or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.AKSSummary] + :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.AKSSummaryListResult] = 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_aks_assessment_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_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("AKSSummaryListResult", 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, project_name: str, assessment_name: str, summary_name: str, **kwargs: Any + ) -> _models.AKSSummary: + """Get a AKSSummary. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_name: str + :param summary_name: AKS Assessment Summary Name. Required. + :type summary_name: str + :return: AKSSummary or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AKSSummary + :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.AKSSummary] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_name, + summary_name=summary_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("AKSSummary", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_machines_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_machines_operations_operations.py new file mode 100644 index 000000000000..3ff4f48c199d --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_machines_operations_operations.py @@ -0,0 +1,242 @@ +# 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._assessed_machines_operations_operations import build_get_request, build_list_by_assessment_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 AssessedMachinesOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`assessed_machines_operations` 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_assessment( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.AssessedMachine"]: + """List AssessedMachine resources by Assessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Machine Assessment ARM name. Required. + :type assessment_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either AssessedMachine or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.AssessedMachine] + :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.AssessedMachineListResult] = 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_assessment_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("AssessedMachineListResult", 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, + project_name: str, + group_name: str, + assessment_name: str, + assessed_machine_name: str, + **kwargs: Any + ) -> _models.AssessedMachine: + """Get a AssessedMachine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Machine Assessment ARM name. Required. + :type assessment_name: str + :param assessed_machine_name: Machine assessment Assessed Machine ARM name. Required. + :type assessed_machine_name: str + :return: AssessedMachine or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AssessedMachine + :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.AssessedMachine] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + assessed_machine_name=assessed_machine_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("AssessedMachine", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_sql_database_v2_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_sql_database_v2_operations_operations.py new file mode 100644 index 000000000000..a0fdf487c70b --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_sql_database_v2_operations_operations.py @@ -0,0 +1,246 @@ +# 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._assessed_sql_database_v2_operations_operations import ( + build_get_request, + build_list_by_sql_assessment_v2_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 AssessedSqlDatabaseV2OperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`assessed_sql_database_v2_operations` 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_sql_assessment_v2( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.AssessedSqlDatabaseV2"]: + """List AssessedSqlDatabaseV2 resources by SqlAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either AssessedSqlDatabaseV2 or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.AssessedSqlDatabaseV2] + :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.AssessedSqlDatabaseV2ListResult] = 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_sql_assessment_v2_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("AssessedSqlDatabaseV2ListResult", 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, + project_name: str, + group_name: str, + assessment_name: str, + assessed_sql_database_name: str, + **kwargs: Any + ) -> _models.AssessedSqlDatabaseV2: + """Get a AssessedSqlDatabaseV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param assessed_sql_database_name: Sql assessment Assessed Databases ARM name. Required. + :type assessed_sql_database_name: str + :return: AssessedSqlDatabaseV2 or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AssessedSqlDatabaseV2 + :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.AssessedSqlDatabaseV2] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + assessed_sql_database_name=assessed_sql_database_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("AssessedSqlDatabaseV2", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_sql_instance_v2_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_sql_instance_v2_operations_operations.py new file mode 100644 index 000000000000..53d2ca5bcce3 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_sql_instance_v2_operations_operations.py @@ -0,0 +1,246 @@ +# 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._assessed_sql_instance_v2_operations_operations import ( + build_get_request, + build_list_by_sql_assessment_v2_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 AssessedSqlInstanceV2OperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`assessed_sql_instance_v2_operations` 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_sql_assessment_v2( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.AssessedSqlInstanceV2"]: + """List AssessedSqlInstanceV2 resources by SqlAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either AssessedSqlInstanceV2 or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.AssessedSqlInstanceV2] + :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.AssessedSqlInstanceV2ListResult] = 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_sql_assessment_v2_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("AssessedSqlInstanceV2ListResult", 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, + project_name: str, + group_name: str, + assessment_name: str, + assessed_sql_instance_name: str, + **kwargs: Any + ) -> _models.AssessedSqlInstanceV2: + """Get a AssessedSqlInstanceV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param assessed_sql_instance_name: Sql assessment Assessed Instance ARM name. Required. + :type assessed_sql_instance_name: str + :return: AssessedSqlInstanceV2 or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AssessedSqlInstanceV2 + :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.AssessedSqlInstanceV2] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + assessed_sql_instance_name=assessed_sql_instance_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("AssessedSqlInstanceV2", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_sql_machines_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_sql_machines_operations_operations.py new file mode 100644 index 000000000000..fea875331e68 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_sql_machines_operations_operations.py @@ -0,0 +1,245 @@ +# 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._assessed_sql_machines_operations_operations import ( + build_get_request, + build_list_by_sql_assessment_v2_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 AssessedSqlMachinesOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`assessed_sql_machines_operations` 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_sql_assessment_v2( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.AssessedSqlMachine"]: + """List AssessedSqlMachine resources by SqlAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either AssessedSqlMachine or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.AssessedSqlMachine] + :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.AssessedSqlMachineListResult] = 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_sql_assessment_v2_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("AssessedSqlMachineListResult", 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, + project_name: str, + group_name: str, + assessment_name: str, + assessed_sql_machine_name: str, + **kwargs: Any + ) -> _models.AssessedSqlMachine: + """Get a AssessedSqlMachine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param assessed_sql_machine_name: Sql assessment Assessed Machine ARM name. Required. + :type assessed_sql_machine_name: str + :return: AssessedSqlMachine or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AssessedSqlMachine + :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.AssessedSqlMachine] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + assessed_sql_machine_name=assessed_sql_machine_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("AssessedSqlMachine", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_sql_recommended_entity_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_sql_recommended_entity_operations_operations.py new file mode 100644 index 000000000000..af2859925bcb --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_sql_recommended_entity_operations_operations.py @@ -0,0 +1,247 @@ +# 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._assessed_sql_recommended_entity_operations_operations import ( + build_get_request, + build_list_by_sql_assessment_v2_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 AssessedSqlRecommendedEntityOperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`assessed_sql_recommended_entity_operations` 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_sql_assessment_v2( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.AssessedSqlRecommendedEntity"]: + """List AssessedSqlRecommendedEntity resources by SqlAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either AssessedSqlRecommendedEntity or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.AssessedSqlRecommendedEntity] + :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.AssessedSqlRecommendedEntityListResult] = 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_sql_assessment_v2_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("AssessedSqlRecommendedEntityListResult", 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, + project_name: str, + group_name: str, + assessment_name: str, + recommended_assessed_entity_name: str, + **kwargs: Any + ) -> _models.AssessedSqlRecommendedEntity: + """Get a AssessedSqlRecommendedEntity. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param recommended_assessed_entity_name: Sql assessment Assessed Recommended Entity ARM name. + Required. + :type recommended_assessed_entity_name: str + :return: AssessedSqlRecommendedEntity or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AssessedSqlRecommendedEntity + :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.AssessedSqlRecommendedEntity] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + recommended_assessed_entity_name=recommended_assessed_entity_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("AssessedSqlRecommendedEntity", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_web_app_v2_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_web_app_v2_operations_operations.py new file mode 100644 index 000000000000..fa188463e91c --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_web_app_v2_operations_operations.py @@ -0,0 +1,245 @@ +# 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._assessed_web_app_v2_operations_operations import ( + build_get_request, + build_list_by_web_app_assessment_v2_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 AssessedWebAppV2OperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`assessed_web_app_v2_operations` 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_web_app_assessment_v2( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.AssessedWebAppV2"]: + """List AssessedWebAppV2 resources by WebAppAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Web app Assessment arm name. Required. + :type assessment_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either AssessedWebAppV2 or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.AssessedWebAppV2] + :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.AssessedWebAppV2ListResult] = 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_web_app_assessment_v2_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("AssessedWebAppV2ListResult", 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, + project_name: str, + group_name: str, + assessment_name: str, + assessed_web_app_name: str, + **kwargs: Any + ) -> _models.AssessedWebAppV2: + """Get a AssessedWebAppV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Web app Assessment arm name. Required. + :type assessment_name: str + :param assessed_web_app_name: Assessed web app ARM name. Required. + :type assessed_web_app_name: str + :return: AssessedWebAppV2 or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AssessedWebAppV2 + :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.AssessedWebAppV2] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + assessed_web_app_name=assessed_web_app_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("AssessedWebAppV2", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_web_application_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_web_application_operations_operations.py new file mode 100644 index 000000000000..14b6ea1477fd --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessed_web_application_operations_operations.py @@ -0,0 +1,232 @@ +# 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._assessed_web_application_operations_operations import ( + build_get_request, + build_list_by_aks_assessment_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 AssessedWebApplicationOperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`assessed_web_application_operations` 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_aks_assessment( + self, + resource_group_name: str, + project_name: str, + assessment_name: str, + continuation_token_parameter: Optional[str] = None, + top: Optional[int] = None, + filter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.AssessedWebApplication"]: + """List AssessedWebApplication resources by AKSAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_name: str + :param continuation_token_parameter: Continuation Token Query Parameter. Default value is None. + :type continuation_token_parameter: str + :param top: Page Size Query Parameter. Default value is None. + :type top: int + :param filter: Filter Query Parameter. Default value is None. + :type filter: str + :param total_record_count: Total Record Count Query Parameter. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either AssessedWebApplication or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.AssessedWebApplication] + :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.AssessedWebApplicationListResult] = 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_aks_assessment_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + continuation_token_parameter=continuation_token_parameter, + top=top, + filter=filter, + total_record_count=total_record_count, + 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("AssessedWebApplicationListResult", 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, project_name: str, assessment_name: str, assessed_workload: str, **kwargs: Any + ) -> _models.AssessedWebApplication: + """Get a AssessedWebApplication. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_name: str + :param assessed_workload: Assessed Web Application Name. Required. + :type assessed_workload: str + :return: AssessedWebApplication or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AssessedWebApplication + :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.AssessedWebApplication] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_name, + assessed_workload=assessed_workload, + 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("AssessedWebApplication", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessment_options_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessment_options_operations_operations.py new file mode 100644 index 000000000000..1fcd8e16c78e --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessment_options_operations_operations.py @@ -0,0 +1,206 @@ +# 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._assessment_options_operations_operations import ( + build_get_request, + build_list_by_assessment_project_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 AssessmentOptionsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`assessment_options_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> AsyncIterable["_models.AssessmentOptions"]: + """List AssessmentOptions resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either AssessmentOptions or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.AssessmentOptions] + :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.AssessmentOptionsListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("AssessmentOptionsListResult", 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, project_name: str, assessment_options_name: str, **kwargs: Any + ) -> _models.AssessmentOptions: + """Get a AssessmentOptions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_options_name: assessment options ARM name. Accepted value is 'default'. + Required. + :type assessment_options_name: str + :return: AssessmentOptions or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AssessmentOptions + :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.AssessmentOptions] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_options_name=assessment_options_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("AssessmentOptions", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessment_project_summary_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessment_project_summary_operations_operations.py new file mode 100644 index 000000000000..c1f5c3be8702 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessment_project_summary_operations_operations.py @@ -0,0 +1,206 @@ +# 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._assessment_project_summary_operations_operations import ( + build_get_request, + build_list_by_assessment_project_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 AssessmentProjectSummaryOperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`assessment_project_summary_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> AsyncIterable["_models.AssessmentProjectSummary"]: + """List AssessmentProjectSummary resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either AssessmentProjectSummary or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.AssessmentProjectSummary] + :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.AssessmentProjectSummaryListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("AssessmentProjectSummaryListResult", 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, project_name: str, project_summary_name: str, **kwargs: Any + ) -> _models.AssessmentProjectSummary: + """Get a AssessmentProjectSummary. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param project_summary_name: Group ARM name. Required. + :type project_summary_name: str + :return: AssessmentProjectSummary or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AssessmentProjectSummary + :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.AssessmentProjectSummary] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + project_summary_name=project_summary_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("AssessmentProjectSummary", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessment_projects_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessment_projects_operations_operations.py new file mode 100644 index 000000000000..d13821a338a3 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessment_projects_operations_operations.py @@ -0,0 +1,740 @@ +# 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._assessment_projects_operations_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AssessmentProjectsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`assessment_projects_operations` 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_subscription(self, **kwargs: Any) -> AsyncIterable["_models.AssessmentProject"]: + """List AssessmentProject resources by subscription ID. + + :return: An iterator like instance of either AssessmentProject or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.AssessmentProject] + :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.AssessmentProjectListResult] = 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("AssessmentProjectListResult", 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, **kwargs: Any + ) -> AsyncIterable["_models.AssessmentProject"]: + """List AssessmentProject resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either AssessmentProject or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.AssessmentProject] + :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.AssessmentProjectListResult] = 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, + 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("AssessmentProjectListResult", 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, project_name: str, **kwargs: Any) -> _models.AssessmentProject: + """Get a AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: AssessmentProject or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AssessmentProject + :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.AssessmentProject] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_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("AssessmentProject", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + project_name: str, + resource: Union[_models.AssessmentProject, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "AssessmentProject") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_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["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( + self, + resource_group_name: str, + project_name: str, + resource: _models.AssessmentProject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AssessmentProject]: + """Create a AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.AssessmentProject + :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 AssessmentProject or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.AssessmentProject] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + project_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AssessmentProject]: + """Create a AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AssessmentProject or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.AssessmentProject] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + project_name: str, + resource: Union[_models.AssessmentProject, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.AssessmentProject]: + """Create a AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param resource: Resource create parameters. Is either a AssessmentProject type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.migrationassessment.models.AssessmentProject or IO[bytes] + :return: An instance of AsyncLROPoller that returns either AssessmentProject or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.AssessmentProject] + :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.AssessmentProject] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + resource=resource, + 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("AssessmentProject", 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.AssessmentProject].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AssessmentProject]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + project_name: str, + properties: Union[_models.AssessmentProjectUpdate, 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(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "AssessmentProjectUpdate") + + _request = build_update_request( + resource_group_name=resource_group_name, + project_name=project_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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + 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, + project_name: str, + properties: _models.AssessmentProjectUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AssessmentProject]: + """Update a AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.migrationassessment.models.AssessmentProjectUpdate + :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 AssessmentProject or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.AssessmentProject] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + project_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AssessmentProject]: + """Update a AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param properties: The resource properties to be updated. Required. + :type properties: 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 AssessmentProject or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.AssessmentProject] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + project_name: str, + properties: Union[_models.AssessmentProjectUpdate, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.AssessmentProject]: + """Update a AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param properties: The resource properties to be updated. Is either a AssessmentProjectUpdate + type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.migrationassessment.models.AssessmentProjectUpdate or IO[bytes] + :return: An instance of AsyncLROPoller that returns either AssessmentProject or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.AssessmentProject] + :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.AssessmentProject] = 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, + project_name=project_name, + properties=properties, + 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("AssessmentProject", 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.AssessmentProject].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AssessmentProject]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def delete(self, resource_group_name: str, project_name: str, **kwargs: Any) -> None: + """Delete a AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_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_request( + resource_group_name=resource_group_name, + project_name=project_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/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessments_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessments_operations_operations.py new file mode 100644 index 000000000000..33d64368a1e7 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_assessments_operations_operations.py @@ -0,0 +1,654 @@ +# 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._assessments_operations_operations import ( + build_create_request, + build_delete_request, + build_download_url_request, + build_get_request, + build_list_by_group_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AssessmentsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`assessments_operations` 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_group( + self, resource_group_name: str, project_name: str, group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Assessment"]: + """List Assessment resources by Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :return: An iterator like instance of either Assessment or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.Assessment] + :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.AssessmentListResult] = 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_group_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_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("AssessmentListResult", 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, project_name: str, group_name: str, assessment_name: str, **kwargs: Any + ) -> _models.Assessment: + """Get a Assessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Machine Assessment ARM name. Required. + :type assessment_name: str + :return: Assessment or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.Assessment + :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.Assessment] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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("Assessment", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: Union[_models.Assessment, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "Assessment") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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["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( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: _models.Assessment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Assessment]: + """Create a Assessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Machine Assessment ARM name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.Assessment + :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 Assessment or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.Assessment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Assessment]: + """Create a Assessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Machine Assessment ARM name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either Assessment or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.Assessment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: Union[_models.Assessment, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Assessment]: + """Create a Assessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Machine Assessment ARM name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Is either a Assessment type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.migrationassessment.models.Assessment or IO[bytes] + :return: An instance of AsyncLROPoller that returns either Assessment or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.Assessment] + :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.Assessment] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + resource=resource, + 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("Assessment", 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.Assessment].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Assessment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def delete( + self, resource_group_name: str, project_name: str, group_name: str, assessment_name: str, **kwargs: Any + ) -> None: + """Delete a Assessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Machine Assessment ARM name. Required. + :type assessment_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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 + + async def _download_url_initial( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + body: JSON, + **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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _json = self._serialize.body(body, "object") + + _request = build_download_url_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_download_url( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + body: JSON, + **kwargs: Any + ) -> AsyncLROPoller[_models.DownloadUrl]: + """Get download URL for the assessment report. + + Get the URL for downloading the assessment in a report format. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Machine Assessment ARM name. Required. + :type assessment_name: str + :param body: The content of the action request. Required. + :type body: JSON + :return: An instance of AsyncLROPoller that returns either DownloadUrl or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.DownloadUrl] + :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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.DownloadUrl] = 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._download_url_initial( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + body=body, + 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("DownloadUrl", 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.DownloadUrl].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DownloadUrl]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_avs_assessed_machines_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_avs_assessed_machines_operations_operations.py new file mode 100644 index 000000000000..a6c298ccfd50 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_avs_assessed_machines_operations_operations.py @@ -0,0 +1,245 @@ +# 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._avs_assessed_machines_operations_operations import ( + build_get_request, + build_list_by_avs_assessment_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 AvsAssessedMachinesOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`avs_assessed_machines_operations` 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_avs_assessment( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.AvsAssessedMachine"]: + """List AvsAssessedMachine resources by AvsAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: AVS Assessment ARM name. Required. + :type assessment_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either AvsAssessedMachine or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.AvsAssessedMachine] + :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.AvsAssessedMachineListResult] = 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_avs_assessment_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("AvsAssessedMachineListResult", 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, + project_name: str, + group_name: str, + assessment_name: str, + avs_assessed_machine_name: str, + **kwargs: Any + ) -> _models.AvsAssessedMachine: + """Get a AvsAssessedMachine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: AVS Assessment ARM name. Required. + :type assessment_name: str + :param avs_assessed_machine_name: AVS assessment Assessed Machine ARM name. Required. + :type avs_assessed_machine_name: str + :return: AvsAssessedMachine or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AvsAssessedMachine + :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.AvsAssessedMachine] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + avs_assessed_machine_name=avs_assessed_machine_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("AvsAssessedMachine", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_avs_assessment_options_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_avs_assessment_options_operations_operations.py new file mode 100644 index 000000000000..d60b9fde7eb0 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_avs_assessment_options_operations_operations.py @@ -0,0 +1,207 @@ +# 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._avs_assessment_options_operations_operations import ( + build_get_request, + build_list_by_assessment_project_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 AvsAssessmentOptionsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`avs_assessment_options_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> AsyncIterable["_models.AvsAssessmentOptions"]: + """List AvsAssessmentOptions resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either AvsAssessmentOptions or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.AvsAssessmentOptions] + :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.AvsAssessmentOptionsListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("AvsAssessmentOptionsListResult", 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, project_name: str, avs_assessment_options_name: str, **kwargs: Any + ) -> _models.AvsAssessmentOptions: + """Get a AvsAssessmentOptions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param avs_assessment_options_name: AVS Assessment options ARM name. Accepted value is + 'default'. Required. + :type avs_assessment_options_name: str + :return: AvsAssessmentOptions or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AvsAssessmentOptions + :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.AvsAssessmentOptions] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + avs_assessment_options_name=avs_assessment_options_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("AvsAssessmentOptions", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_avs_assessments_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_avs_assessments_operations_operations.py new file mode 100644 index 000000000000..8f4db390876b --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_avs_assessments_operations_operations.py @@ -0,0 +1,657 @@ +# 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._avs_assessments_operations_operations import ( + build_create_request, + build_delete_request, + build_download_url_request, + build_get_request, + build_list_by_group_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AvsAssessmentsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`avs_assessments_operations` 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_group( + self, resource_group_name: str, project_name: str, group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.AvsAssessment"]: + """List AvsAssessment resources by Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :return: An iterator like instance of either AvsAssessment or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.AvsAssessment] + :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.AvsAssessmentListResult] = 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_group_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_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("AvsAssessmentListResult", 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, project_name: str, group_name: str, assessment_name: str, **kwargs: Any + ) -> _models.AvsAssessment: + """Get a AvsAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: AVS Assessment ARM name. Required. + :type assessment_name: str + :return: AvsAssessment or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AvsAssessment + :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.AvsAssessment] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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("AvsAssessment", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: Union[_models.AvsAssessment, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "AvsAssessment") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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["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( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: _models.AvsAssessment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AvsAssessment]: + """Create a AvsAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: AVS Assessment ARM name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.AvsAssessment + :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 AvsAssessment or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.AvsAssessment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AvsAssessment]: + """Create a AvsAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: AVS Assessment ARM name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AvsAssessment or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.AvsAssessment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: Union[_models.AvsAssessment, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.AvsAssessment]: + """Create a AvsAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: AVS Assessment ARM name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Is either a AvsAssessment type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.migrationassessment.models.AvsAssessment or IO[bytes] + :return: An instance of AsyncLROPoller that returns either AvsAssessment or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.AvsAssessment] + :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.AvsAssessment] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + resource=resource, + 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("AvsAssessment", 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.AvsAssessment].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AvsAssessment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def delete( + self, resource_group_name: str, project_name: str, group_name: str, assessment_name: str, **kwargs: Any + ) -> None: + """Delete a AvsAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: AVS Assessment ARM name. Required. + :type assessment_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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 + + async def _download_url_initial( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + body: JSON, + **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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _json = self._serialize.body(body, "object") + + _request = build_download_url_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_download_url( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + body: JSON, + **kwargs: Any + ) -> AsyncLROPoller[_models.DownloadUrl]: + """Get download URL for the assessment report. + + Get the URL for downloading the assessment in a report format. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: AVS Assessment ARM name. Required. + :type assessment_name: str + :param body: The content of the action request. Required. + :type body: JSON + :return: An instance of AsyncLROPoller that returns either DownloadUrl or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.DownloadUrl] + :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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.DownloadUrl] = 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._download_url_initial( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + body=body, + 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("DownloadUrl", 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.DownloadUrl].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DownloadUrl]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_business_case_avs_summary_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_business_case_avs_summary_operations_operations.py new file mode 100644 index 000000000000..eef6da42a5f7 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_business_case_avs_summary_operations_operations.py @@ -0,0 +1,211 @@ +# 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._business_case_avs_summary_operations_operations import ( + build_get_request, + build_list_by_business_case_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 BusinessCaseAvsSummaryOperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`business_case_avs_summary_operations` 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_business_case( + self, resource_group_name: str, project_name: str, business_case_name: str, **kwargs: Any + ) -> AsyncIterable["_models.AvsSummary"]: + """List AvsSummary resources by BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :return: An iterator like instance of either AvsSummary or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.AvsSummary] + :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.AvsSummaryListResult] = 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_business_case_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_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("AvsSummaryListResult", 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, project_name: str, business_case_name: str, avs_summary_name: str, **kwargs: Any + ) -> _models.AvsSummary: + """Get a AvsSummary. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param avs_summary_name: Gets the Name of the Avs Summary. Required. + :type avs_summary_name: str + :return: AvsSummary or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AvsSummary + :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.AvsSummary] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + avs_summary_name=avs_summary_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("AvsSummary", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_business_case_iaas_summary_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_business_case_iaas_summary_operations_operations.py new file mode 100644 index 000000000000..85696bf3f2c3 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_business_case_iaas_summary_operations_operations.py @@ -0,0 +1,216 @@ +# 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._business_case_iaas_summary_operations_operations import ( + build_get_request, + build_list_by_business_case_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 BusinessCaseIaasSummaryOperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`business_case_iaas_summary_operations` 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_business_case( + self, resource_group_name: str, project_name: str, business_case_name: str, **kwargs: Any + ) -> AsyncIterable["_models.IaasSummary"]: + """List IaasSummary resources by BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :return: An iterator like instance of either IaasSummary or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.IaasSummary] + :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.IaasSummaryListResult] = 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_business_case_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_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("IaasSummaryListResult", 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, + project_name: str, + business_case_name: str, + iaas_summary_name: str, + **kwargs: Any + ) -> _models.IaasSummary: + """Get a IaasSummary. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param iaas_summary_name: Gets the Name of the Iaas Summary. Required. + :type iaas_summary_name: str + :return: IaasSummary or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.IaasSummary + :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.IaasSummary] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + iaas_summary_name=iaas_summary_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("IaasSummary", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_business_case_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_business_case_operations_operations.py new file mode 100644 index 000000000000..3b505a54c1b6 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_business_case_operations_operations.py @@ -0,0 +1,752 @@ +# 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._business_case_operations_operations import ( + build_compare_summary_request, + build_create_request, + build_delete_request, + build_get_report_download_url_request, + build_get_request, + build_list_by_assessment_project_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BusinessCaseOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`business_case_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BusinessCase"]: + """List BusinessCase resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either BusinessCase or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.BusinessCase] + :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.BusinessCaseListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("BusinessCaseListResult", 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, project_name: str, business_case_name: str, **kwargs: Any + ) -> _models.BusinessCase: + """Get a BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :return: BusinessCase or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.BusinessCase + :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.BusinessCase] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_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("BusinessCase", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + project_name: str, + business_case_name: str, + resource: Union[_models.BusinessCase, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "BusinessCase") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_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["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( + self, + resource_group_name: str, + project_name: str, + business_case_name: str, + resource: _models.BusinessCase, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BusinessCase]: + """Create a BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.BusinessCase + :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 BusinessCase or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.BusinessCase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + project_name: str, + business_case_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BusinessCase]: + """Create a BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BusinessCase or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.BusinessCase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + project_name: str, + business_case_name: str, + resource: Union[_models.BusinessCase, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.BusinessCase]: + """Create a BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param resource: Resource create parameters. Is either a BusinessCase type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.migrationassessment.models.BusinessCase or IO[bytes] + :return: An instance of AsyncLROPoller that returns either BusinessCase or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.BusinessCase] + :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.BusinessCase] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + resource=resource, + 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("BusinessCase", 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.BusinessCase].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BusinessCase]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def delete(self, resource_group_name: str, project_name: str, business_case_name: str, **kwargs: Any) -> None: + """Delete a BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_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 + + async def _compare_summary_initial( + self, resource_group_name: str, project_name: str, business_case_name: str, body: JSON, **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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _json = self._serialize.body(body, "object") + + _request = build_compare_summary_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_compare_summary( + self, resource_group_name: str, project_name: str, business_case_name: str, body: JSON, **kwargs: Any + ) -> AsyncLROPoller[_models.CompareSummary]: + """Get Compare summary report for Business case. + + A long-running resource action. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param body: The content of the action request. Required. + :type body: JSON + :return: An instance of AsyncLROPoller that returns either CompareSummary or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.CompareSummary] + :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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.CompareSummary] = 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._compare_summary_initial( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + body=body, + 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("CompareSummary", 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.CompareSummary].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CompareSummary]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _get_report_download_url_initial( + self, resource_group_name: str, project_name: str, business_case_name: str, body: JSON, **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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _json = self._serialize.body(body, "object") + + _request = build_get_report_download_url_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_get_report_download_url( + self, resource_group_name: str, project_name: str, business_case_name: str, body: JSON, **kwargs: Any + ) -> AsyncLROPoller[_models.ReportDownloadUrl]: + """Get download URL for the business case report. + + Get the URL for downloading the business case in a report format. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param body: The content of the action request. Required. + :type body: JSON + :return: An instance of AsyncLROPoller that returns either ReportDownloadUrl or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.ReportDownloadUrl] + :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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.ReportDownloadUrl] = 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._get_report_download_url_initial( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + body=body, + 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("ReportDownloadUrl", 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.ReportDownloadUrl].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ReportDownloadUrl]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_business_case_overview_summary_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_business_case_overview_summary_operations_operations.py new file mode 100644 index 000000000000..55813aafbad4 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_business_case_overview_summary_operations_operations.py @@ -0,0 +1,216 @@ +# 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._business_case_overview_summary_operations_operations import ( + build_get_request, + build_list_by_business_case_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 BusinessCaseOverviewSummaryOperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`business_case_overview_summary_operations` 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_business_case( + self, resource_group_name: str, project_name: str, business_case_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OverviewSummary"]: + """List OverviewSummary resources by BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :return: An iterator like instance of either OverviewSummary or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.OverviewSummary] + :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.OverviewSummaryListResult] = 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_business_case_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_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("OverviewSummaryListResult", 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, + project_name: str, + business_case_name: str, + overview_summary_name: str, + **kwargs: Any + ) -> _models.OverviewSummary: + """Get a OverviewSummary. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param overview_summary_name: Gets the Name of the Overview Summary. Required. + :type overview_summary_name: str + :return: OverviewSummary or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.OverviewSummary + :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.OverviewSummary] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + overview_summary_name=overview_summary_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("OverviewSummary", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_business_case_paas_summary_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_business_case_paas_summary_operations_operations.py new file mode 100644 index 000000000000..fcbab6a4c68b --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_business_case_paas_summary_operations_operations.py @@ -0,0 +1,216 @@ +# 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._business_case_paas_summary_operations_operations import ( + build_get_request, + build_list_by_business_case_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 BusinessCasePaasSummaryOperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`business_case_paas_summary_operations` 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_business_case( + self, resource_group_name: str, project_name: str, business_case_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PaasSummary"]: + """List PaasSummary resources by BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :return: An iterator like instance of either PaasSummary or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.PaasSummary] + :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.PaasSummaryListResult] = 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_business_case_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_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("PaasSummaryListResult", 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, + project_name: str, + business_case_name: str, + paas_summary_name: str, + **kwargs: Any + ) -> _models.PaasSummary: + """Get a PaasSummary. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param paas_summary_name: Gets the Name of the Paas Summary. Required. + :type paas_summary_name: str + :return: PaasSummary or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.PaasSummary + :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.PaasSummary] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + paas_summary_name=paas_summary_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("PaasSummary", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_evaluated_avs_machines_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_evaluated_avs_machines_operations_operations.py new file mode 100644 index 000000000000..5eb20754fbac --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_evaluated_avs_machines_operations_operations.py @@ -0,0 +1,237 @@ +# 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._evaluated_avs_machines_operations_operations import ( + build_get_request, + build_list_by_business_case_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 EvaluatedAvsMachinesOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`evaluated_avs_machines_operations` 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_business_case( + self, + resource_group_name: str, + project_name: str, + business_case_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.EvaluatedAvsMachine"]: + """List EvaluatedAvsMachine resources by BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either EvaluatedAvsMachine or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.EvaluatedAvsMachine] + :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.EvaluatedAvsMachineListResult] = 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_business_case_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("EvaluatedAvsMachineListResult", 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, + project_name: str, + business_case_name: str, + evaluated_avs_machine_name: str, + **kwargs: Any + ) -> _models.EvaluatedAvsMachine: + """Get a EvaluatedAvsMachine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param evaluated_avs_machine_name: Business case Evaluated AVS machine ARM name. Required. + :type evaluated_avs_machine_name: str + :return: EvaluatedAvsMachine or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.EvaluatedAvsMachine + :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.EvaluatedAvsMachine] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + evaluated_avs_machine_name=evaluated_avs_machine_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("EvaluatedAvsMachine", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_evaluated_machines_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_evaluated_machines_operations_operations.py new file mode 100644 index 000000000000..ab3a88e96fa0 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_evaluated_machines_operations_operations.py @@ -0,0 +1,237 @@ +# 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._evaluated_machines_operations_operations import ( + build_get_request, + build_list_by_business_case_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 EvaluatedMachinesOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`evaluated_machines_operations` 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_business_case( + self, + resource_group_name: str, + project_name: str, + business_case_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.EvaluatedMachine"]: + """List EvaluatedMachine resources by BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either EvaluatedMachine or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.EvaluatedMachine] + :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.EvaluatedMachineListResult] = 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_business_case_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("EvaluatedMachineListResult", 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, + project_name: str, + business_case_name: str, + evaluated_machine_name: str, + **kwargs: Any + ) -> _models.EvaluatedMachine: + """Get a EvaluatedMachine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param evaluated_machine_name: Business case Evaluated machine ARM name. Required. + :type evaluated_machine_name: str + :return: EvaluatedMachine or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.EvaluatedMachine + :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.EvaluatedMachine] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + evaluated_machine_name=evaluated_machine_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("EvaluatedMachine", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_evaluated_sql_entities_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_evaluated_sql_entities_operations_operations.py new file mode 100644 index 000000000000..88a80f67362c --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_evaluated_sql_entities_operations_operations.py @@ -0,0 +1,237 @@ +# 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._evaluated_sql_entities_operations_operations import ( + build_get_request, + build_list_by_business_case_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 EvaluatedSqlEntitiesOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`evaluated_sql_entities_operations` 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_business_case( + self, + resource_group_name: str, + project_name: str, + business_case_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.EvaluatedSqlEntity"]: + """List EvaluatedSqlEntity resources by BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either EvaluatedSqlEntity or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.EvaluatedSqlEntity] + :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.EvaluatedSqlEntityListResult] = 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_business_case_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("EvaluatedSqlEntityListResult", 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, + project_name: str, + business_case_name: str, + evaluated_sql_entity_name: str, + **kwargs: Any + ) -> _models.EvaluatedSqlEntity: + """Get a EvaluatedSqlEntity. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param evaluated_sql_entity_name: Business case Evaluated sql entity ARM name. Required. + :type evaluated_sql_entity_name: str + :return: EvaluatedSqlEntity or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.EvaluatedSqlEntity + :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.EvaluatedSqlEntity] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + evaluated_sql_entity_name=evaluated_sql_entity_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("EvaluatedSqlEntity", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_evaluated_web_apps_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_evaluated_web_apps_operations_operations.py new file mode 100644 index 000000000000..264f80a092c5 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_evaluated_web_apps_operations_operations.py @@ -0,0 +1,237 @@ +# 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._evaluated_web_apps_operations_operations import ( + build_get_request, + build_list_by_business_case_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 EvaluatedWebAppsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`evaluated_web_apps_operations` 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_business_case( + self, + resource_group_name: str, + project_name: str, + business_case_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.EvaluatedWebApp"]: + """List EvaluatedWebApp resources by BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either EvaluatedWebApp or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.EvaluatedWebApp] + :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.EvaluatedWebAppListResult] = 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_business_case_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("EvaluatedWebAppListResult", 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, + project_name: str, + business_case_name: str, + evaluated_web_app_name: str, + **kwargs: Any + ) -> _models.EvaluatedWebApp: + """Get a EvaluatedWebApp. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param evaluated_web_app_name: Business case Evaluated web App ARM name. Required. + :type evaluated_web_app_name: str + :return: EvaluatedWebApp or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.EvaluatedWebApp + :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.EvaluatedWebApp] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + evaluated_web_app_name=evaluated_web_app_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("EvaluatedWebApp", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_groups_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_groups_operations_operations.py new file mode 100644 index 000000000000..88251f93b545 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_groups_operations_operations.py @@ -0,0 +1,689 @@ +# 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._groups_operations_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_assessment_project_request, + build_update_machines_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 GroupsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`groups_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Group"]: + """List Group resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either Group or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.Group] + :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.GroupListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("GroupListResult", 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, project_name: str, group_name: str, **kwargs: Any) -> _models.Group: + """Get a Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :return: Group or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.Group + :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.Group] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=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]: + map_error(status_code=response.status_code, 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("Group", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + project_name: str, + group_name: str, + resource: Union[_models.Group, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "Group") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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["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( + self, + resource_group_name: str, + project_name: str, + group_name: str, + resource: _models.Group, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Group]: + """Create a Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.Group + :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 Group or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.Group] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + project_name: str, + group_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Group]: + """Create a Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either Group or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.Group] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + project_name: str, + group_name: str, + resource: Union[_models.Group, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Group]: + """Create a Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param resource: Resource create parameters. Is either a Group type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.migrationassessment.models.Group or IO[bytes] + :return: An instance of AsyncLROPoller that returns either Group or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.Group] + :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.Group] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + resource=resource, + 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("Group", 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.Group].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Group]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def delete(self, resource_group_name: str, project_name: str, group_name: str, **kwargs: Any) -> None: + """Delete a Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=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) + 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 + + async def _update_machines_initial( + self, + resource_group_name: str, + project_name: str, + group_name: str, + body: Union[_models.UpdateGroupBody, 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(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateGroupBody") + + _request = build_update_machines_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + 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_machines( + self, + resource_group_name: str, + project_name: str, + group_name: str, + body: _models.UpdateGroupBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Group]: + """Update machines in group. + + Update machines in group by adding or removing machines. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.migrationassessment.models.UpdateGroupBody + :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 Group or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.Group] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_machines( + self, + resource_group_name: str, + project_name: str, + group_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Group]: + """Update machines in group. + + Update machines in group by adding or removing machines. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param body: The content of the action request. Required. + :type 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: An instance of AsyncLROPoller that returns either Group or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.Group] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_machines( + self, + resource_group_name: str, + project_name: str, + group_name: str, + body: Union[_models.UpdateGroupBody, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Group]: + """Update machines in group. + + Update machines in group by adding or removing machines. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param body: The content of the action request. Is either a UpdateGroupBody type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.migrationassessment.models.UpdateGroupBody or IO[bytes] + :return: An instance of AsyncLROPoller that returns either Group or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.Group] + :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.Group] = 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_machines_initial( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + body=body, + 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("Group", 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.Group].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Group]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_hyperv_collectors_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_hyperv_collectors_operations_operations.py new file mode 100644 index 000000000000..82323cc57d28 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_hyperv_collectors_operations_operations.py @@ -0,0 +1,484 @@ +# 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._hyperv_collectors_operations_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_assessment_project_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 HypervCollectorsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`hyperv_collectors_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> AsyncIterable["_models.HypervCollector"]: + """List HypervCollector resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either HypervCollector or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.HypervCollector] + :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.HypervCollectorListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("HypervCollectorListResult", 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, project_name: str, hyperv_collector_name: str, **kwargs: Any + ) -> _models.HypervCollector: + """Get a HypervCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param hyperv_collector_name: Hyper-V collector ARM name. Required. + :type hyperv_collector_name: str + :return: HypervCollector or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.HypervCollector + :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.HypervCollector] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + hyperv_collector_name=hyperv_collector_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("HypervCollector", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + project_name: str, + hyperv_collector_name: str, + resource: Union[_models.HypervCollector, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "HypervCollector") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + hyperv_collector_name=hyperv_collector_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["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( + self, + resource_group_name: str, + project_name: str, + hyperv_collector_name: str, + resource: _models.HypervCollector, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.HypervCollector]: + """Create a HypervCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param hyperv_collector_name: Hyper-V collector ARM name. Required. + :type hyperv_collector_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.HypervCollector + :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 HypervCollector or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.HypervCollector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + project_name: str, + hyperv_collector_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.HypervCollector]: + """Create a HypervCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param hyperv_collector_name: Hyper-V collector ARM name. Required. + :type hyperv_collector_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either HypervCollector or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.HypervCollector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + project_name: str, + hyperv_collector_name: str, + resource: Union[_models.HypervCollector, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.HypervCollector]: + """Create a HypervCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param hyperv_collector_name: Hyper-V collector ARM name. Required. + :type hyperv_collector_name: str + :param resource: Resource create parameters. Is either a HypervCollector type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.migrationassessment.models.HypervCollector or IO[bytes] + :return: An instance of AsyncLROPoller that returns either HypervCollector or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.HypervCollector] + :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.HypervCollector] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + hyperv_collector_name=hyperv_collector_name, + resource=resource, + 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("HypervCollector", 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.HypervCollector].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.HypervCollector]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def delete( + self, resource_group_name: str, project_name: str, hyperv_collector_name: str, **kwargs: Any + ) -> None: + """Delete a HypervCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param hyperv_collector_name: Hyper-V collector ARM name. Required. + :type hyperv_collector_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + hyperv_collector_name=hyperv_collector_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/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_import_collectors_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_import_collectors_operations_operations.py new file mode 100644 index 000000000000..a3dabfa2b54c --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_import_collectors_operations_operations.py @@ -0,0 +1,484 @@ +# 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._import_collectors_operations_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_assessment_project_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 ImportCollectorsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`import_collectors_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ImportCollector"]: + """List ImportCollector resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either ImportCollector or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.ImportCollector] + :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.ImportCollectorListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("ImportCollectorListResult", 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, project_name: str, import_collector_name: str, **kwargs: Any + ) -> _models.ImportCollector: + """Get a ImportCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param import_collector_name: Import collector ARM name. Required. + :type import_collector_name: str + :return: ImportCollector or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.ImportCollector + :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.ImportCollector] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + import_collector_name=import_collector_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("ImportCollector", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + project_name: str, + import_collector_name: str, + resource: Union[_models.ImportCollector, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "ImportCollector") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + import_collector_name=import_collector_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["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( + self, + resource_group_name: str, + project_name: str, + import_collector_name: str, + resource: _models.ImportCollector, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ImportCollector]: + """Create a ImportCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param import_collector_name: Import collector ARM name. Required. + :type import_collector_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.ImportCollector + :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 ImportCollector or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.ImportCollector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + project_name: str, + import_collector_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ImportCollector]: + """Create a ImportCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param import_collector_name: Import collector ARM name. Required. + :type import_collector_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ImportCollector or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.ImportCollector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + project_name: str, + import_collector_name: str, + resource: Union[_models.ImportCollector, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ImportCollector]: + """Create a ImportCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param import_collector_name: Import collector ARM name. Required. + :type import_collector_name: str + :param resource: Resource create parameters. Is either a ImportCollector type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.migrationassessment.models.ImportCollector or IO[bytes] + :return: An instance of AsyncLROPoller that returns either ImportCollector or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.ImportCollector] + :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.ImportCollector] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + import_collector_name=import_collector_name, + resource=resource, + 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("ImportCollector", 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.ImportCollector].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ImportCollector]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def delete( + self, resource_group_name: str, project_name: str, import_collector_name: str, **kwargs: Any + ) -> None: + """Delete a ImportCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param import_collector_name: Import collector ARM name. Required. + :type import_collector_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + import_collector_name=import_collector_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/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_machines_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_machines_operations_operations.py new file mode 100644 index 000000000000..35013f7e734d --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_machines_operations_operations.py @@ -0,0 +1,221 @@ +# 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._machines_operations_operations import build_get_request, build_list_by_assessment_project_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 MachinesOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`machines_operations` 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_assessment_project( + self, + resource_group_name: str, + project_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.Machine"]: + """List Machine resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either Machine or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.Machine] + :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.MachineListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("MachineListResult", 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, project_name: str, machine_name: str, **kwargs: Any + ) -> _models.Machine: + """Get a Machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param machine_name: Assessible Machine ARM name. Required. + :type machine_name: str + :return: Machine or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.Machine + :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.Machine] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + machine_name=machine_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("Machine", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_operations.py new file mode 100644 index 000000000000..f98f13206d21 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_operations.py @@ -0,0 +1,130 @@ +# 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.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._operations import build_list_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`operations` 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(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """List the operations for the provider. + + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.Operation] + :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.OperationListResult] = 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( + 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("OperationListResult", 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/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_patch.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_private_endpoint_connection_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_private_endpoint_connection_operations_operations.py new file mode 100644 index 000000000000..4d8d2ff4cf72 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_private_endpoint_connection_operations_operations.py @@ -0,0 +1,485 @@ +# 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._private_endpoint_connection_operations_operations import ( + build_delete_request, + build_get_request, + build_list_by_assessment_project_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 PrivateEndpointConnectionOperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`private_endpoint_connection_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnection"]: + """List PrivateEndpointConnection resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.PrivateEndpointConnection] + :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.PrivateEndpointConnectionListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("PrivateEndpointConnectionListResult", 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, project_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Get a PrivateEndpointConnection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param private_endpoint_connection_name: Private endpoint connection ARM name. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.PrivateEndpointConnection + :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.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_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]: + map_error(status_code=response.status_code, 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("PrivateEndpointConnection", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + project_name: str, + private_endpoint_connection_name: str, + resource: Union[_models.PrivateEndpointConnection, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "PrivateEndpointConnection") + + _request = build_update_request( + resource_group_name=resource_group_name, + project_name=project_name, + private_endpoint_connection_name=private_endpoint_connection_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["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, + project_name: str, + private_endpoint_connection_name: str, + resource: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Create a PrivateEndpointConnection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param private_endpoint_connection_name: Private endpoint connection ARM name. Required. + :type private_endpoint_connection_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.PrivateEndpointConnection + :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 PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + project_name: str, + private_endpoint_connection_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Create a PrivateEndpointConnection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param private_endpoint_connection_name: Private endpoint connection ARM name. Required. + :type private_endpoint_connection_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + project_name: str, + private_endpoint_connection_name: str, + resource: Union[_models.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Create a PrivateEndpointConnection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param private_endpoint_connection_name: Private endpoint connection ARM name. Required. + :type private_endpoint_connection_name: str + :param resource: Resource create parameters. Is either a PrivateEndpointConnection type or a + IO[bytes] type. Required. + :type resource: ~azure.mgmt.migrationassessment.models.PrivateEndpointConnection or IO[bytes] + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.PrivateEndpointConnection] + :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.PrivateEndpointConnection] = 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, + project_name=project_name, + private_endpoint_connection_name=private_endpoint_connection_name, + resource=resource, + 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("PrivateEndpointConnection", 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.PrivateEndpointConnection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def delete( + self, resource_group_name: str, project_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> None: + """Delete a PrivateEndpointConnection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param private_endpoint_connection_name: Private endpoint connection ARM name. 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_request( + resource_group_name=resource_group_name, + project_name=project_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/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_private_link_resource_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_private_link_resource_operations_operations.py new file mode 100644 index 000000000000..b2bad49ba672 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_private_link_resource_operations_operations.py @@ -0,0 +1,205 @@ +# 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._private_link_resource_operations_operations import ( + build_get_request, + build_list_by_assessment_project_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 PrivateLinkResourceOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`private_link_resource_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateLinkResource"]: + """List PrivateLinkResource resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.PrivateLinkResource] + :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.PrivateLinkResourceListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("PrivateLinkResourceListResult", 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, project_name: str, private_link_resource_name: str, **kwargs: Any + ) -> _models.PrivateLinkResource: + """Get a PrivateLinkResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param private_link_resource_name: Private link resource ARM name. Required. + :type private_link_resource_name: str + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.PrivateLinkResource + :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.PrivateLinkResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + private_link_resource_name=private_link_resource_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("PrivateLinkResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_server_collectors_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_server_collectors_operations_operations.py new file mode 100644 index 000000000000..d25a3a57b686 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_server_collectors_operations_operations.py @@ -0,0 +1,484 @@ +# 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._server_collectors_operations_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_assessment_project_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 ServerCollectorsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`server_collectors_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ServerCollector"]: + """List ServerCollector resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either ServerCollector or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.ServerCollector] + :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.ServerCollectorListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("ServerCollectorListResult", 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, project_name: str, server_collector_name: str, **kwargs: Any + ) -> _models.ServerCollector: + """Get a ServerCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param server_collector_name: Physical server collector ARM name. Required. + :type server_collector_name: str + :return: ServerCollector or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.ServerCollector + :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.ServerCollector] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + server_collector_name=server_collector_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("ServerCollector", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + project_name: str, + server_collector_name: str, + resource: Union[_models.ServerCollector, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "ServerCollector") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + server_collector_name=server_collector_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["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( + self, + resource_group_name: str, + project_name: str, + server_collector_name: str, + resource: _models.ServerCollector, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServerCollector]: + """Create a ServerCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param server_collector_name: Physical server collector ARM name. Required. + :type server_collector_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.ServerCollector + :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 ServerCollector or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.ServerCollector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + project_name: str, + server_collector_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServerCollector]: + """Create a ServerCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param server_collector_name: Physical server collector ARM name. Required. + :type server_collector_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ServerCollector or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.ServerCollector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + project_name: str, + server_collector_name: str, + resource: Union[_models.ServerCollector, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ServerCollector]: + """Create a ServerCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param server_collector_name: Physical server collector ARM name. Required. + :type server_collector_name: str + :param resource: Resource create parameters. Is either a ServerCollector type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.migrationassessment.models.ServerCollector or IO[bytes] + :return: An instance of AsyncLROPoller that returns either ServerCollector or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.ServerCollector] + :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.ServerCollector] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + server_collector_name=server_collector_name, + resource=resource, + 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("ServerCollector", 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.ServerCollector].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ServerCollector]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def delete( + self, resource_group_name: str, project_name: str, server_collector_name: str, **kwargs: Any + ) -> None: + """Delete a ServerCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param server_collector_name: Physical server collector ARM name. Required. + :type server_collector_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + server_collector_name=server_collector_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/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_sql_assessment_options_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_sql_assessment_options_operations_operations.py new file mode 100644 index 000000000000..6cc1861faa97 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_sql_assessment_options_operations_operations.py @@ -0,0 +1,207 @@ +# 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._sql_assessment_options_operations_operations import ( + build_get_request, + build_list_by_assessment_project_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 SqlAssessmentOptionsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`sql_assessment_options_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SqlAssessmentOptions"]: + """List SqlAssessmentOptions resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either SqlAssessmentOptions or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.SqlAssessmentOptions] + :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.SqlAssessmentOptionsListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("SqlAssessmentOptionsListResult", 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, project_name: str, assessment_options_name: str, **kwargs: Any + ) -> _models.SqlAssessmentOptions: + """Get a SqlAssessmentOptions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_options_name: Sql assessment options ARM name. Accepted values is 'default'. + Required. + :type assessment_options_name: str + :return: SqlAssessmentOptions or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.SqlAssessmentOptions + :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.SqlAssessmentOptions] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_options_name=assessment_options_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("SqlAssessmentOptions", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_sql_assessment_v2_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_sql_assessment_v2_operations_operations.py new file mode 100644 index 000000000000..6e7f4fb93dcd --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_sql_assessment_v2_operations_operations.py @@ -0,0 +1,657 @@ +# 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._sql_assessment_v2_operations_operations import ( + build_create_request, + build_delete_request, + build_download_url_request, + build_get_request, + build_list_by_group_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SqlAssessmentV2OperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`sql_assessment_v2_operations` 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_group( + self, resource_group_name: str, project_name: str, group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SqlAssessmentV2"]: + """List SqlAssessmentV2 resources by Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :return: An iterator like instance of either SqlAssessmentV2 or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.SqlAssessmentV2] + :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.SqlAssessmentV2ListResult] = 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_group_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_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("SqlAssessmentV2ListResult", 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, project_name: str, group_name: str, assessment_name: str, **kwargs: Any + ) -> _models.SqlAssessmentV2: + """Get a SqlAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :return: SqlAssessmentV2 or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.SqlAssessmentV2 + :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.SqlAssessmentV2] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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("SqlAssessmentV2", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: Union[_models.SqlAssessmentV2, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "SqlAssessmentV2") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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["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( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: _models.SqlAssessmentV2, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SqlAssessmentV2]: + """Create a SqlAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.SqlAssessmentV2 + :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 SqlAssessmentV2 or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.SqlAssessmentV2] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SqlAssessmentV2]: + """Create a SqlAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either SqlAssessmentV2 or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.SqlAssessmentV2] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: Union[_models.SqlAssessmentV2, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.SqlAssessmentV2]: + """Create a SqlAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Is either a SqlAssessmentV2 type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.migrationassessment.models.SqlAssessmentV2 or IO[bytes] + :return: An instance of AsyncLROPoller that returns either SqlAssessmentV2 or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.SqlAssessmentV2] + :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.SqlAssessmentV2] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + resource=resource, + 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("SqlAssessmentV2", 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.SqlAssessmentV2].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.SqlAssessmentV2]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def delete( + self, resource_group_name: str, project_name: str, group_name: str, assessment_name: str, **kwargs: Any + ) -> None: + """Delete a SqlAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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 + + async def _download_url_initial( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + body: JSON, + **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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _json = self._serialize.body(body, "object") + + _request = build_download_url_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_download_url( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + body: JSON, + **kwargs: Any + ) -> AsyncLROPoller[_models.DownloadUrl]: + """Get download URL for the assessment report. + + Get the URL for downloading the assessment in a report format. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param body: The content of the action request. Required. + :type body: JSON + :return: An instance of AsyncLROPoller that returns either DownloadUrl or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.DownloadUrl] + :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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.DownloadUrl] = 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._download_url_initial( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + body=body, + 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("DownloadUrl", 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.DownloadUrl].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DownloadUrl]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_sql_assessment_v2_summary_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_sql_assessment_v2_summary_operations_operations.py new file mode 100644 index 000000000000..e11a497b723d --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_sql_assessment_v2_summary_operations_operations.py @@ -0,0 +1,224 @@ +# 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._sql_assessment_v2_summary_operations_operations import ( + build_get_request, + build_list_by_sql_assessment_v2_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 SqlAssessmentV2SummaryOperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`sql_assessment_v2_summary_operations` 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_sql_assessment_v2( + self, resource_group_name: str, project_name: str, group_name: str, assessment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SqlAssessmentV2Summary"]: + """List SqlAssessmentV2Summary resources by SqlAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :return: An iterator like instance of either SqlAssessmentV2Summary or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.SqlAssessmentV2Summary] + :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.SqlAssessmentV2SummaryListResult] = 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_sql_assessment_v2_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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("SqlAssessmentV2SummaryListResult", 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, + project_name: str, + group_name: str, + assessment_name: str, + summary_name: str, + **kwargs: Any + ) -> _models.SqlAssessmentV2Summary: + """Get a SqlAssessmentV2Summary. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param summary_name: Gets the Name of the SQL Summary. Required. + :type summary_name: str + :return: SqlAssessmentV2Summary or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.SqlAssessmentV2Summary + :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.SqlAssessmentV2Summary] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + summary_name=summary_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("SqlAssessmentV2Summary", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_sql_collector_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_sql_collector_operations_operations.py new file mode 100644 index 000000000000..394d528094e7 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_sql_collector_operations_operations.py @@ -0,0 +1,479 @@ +# 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._sql_collector_operations_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_assessment_project_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 SqlCollectorOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`sql_collector_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SqlCollector"]: + """List SqlCollector resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either SqlCollector or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.SqlCollector] + :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.SqlCollectorListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("SqlCollectorListResult", 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, project_name: str, collector_name: str, **kwargs: Any + ) -> _models.SqlCollector: + """Get a SqlCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param collector_name: Sql collector ARM name. Required. + :type collector_name: str + :return: SqlCollector or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.SqlCollector + :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.SqlCollector] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + collector_name=collector_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("SqlCollector", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + project_name: str, + collector_name: str, + resource: Union[_models.SqlCollector, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "SqlCollector") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + collector_name=collector_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["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( + self, + resource_group_name: str, + project_name: str, + collector_name: str, + resource: _models.SqlCollector, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SqlCollector]: + """Create a SqlCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param collector_name: Sql collector ARM name. Required. + :type collector_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.SqlCollector + :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 SqlCollector or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.SqlCollector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + project_name: str, + collector_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SqlCollector]: + """Create a SqlCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param collector_name: Sql collector ARM name. Required. + :type collector_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either SqlCollector or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.SqlCollector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + project_name: str, + collector_name: str, + resource: Union[_models.SqlCollector, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.SqlCollector]: + """Create a SqlCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param collector_name: Sql collector ARM name. Required. + :type collector_name: str + :param resource: Resource create parameters. Is either a SqlCollector type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.migrationassessment.models.SqlCollector or IO[bytes] + :return: An instance of AsyncLROPoller that returns either SqlCollector or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.SqlCollector] + :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.SqlCollector] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + collector_name=collector_name, + resource=resource, + 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("SqlCollector", 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.SqlCollector].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.SqlCollector]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def delete(self, resource_group_name: str, project_name: str, collector_name: str, **kwargs: Any) -> None: + """Delete a SqlCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param collector_name: Sql collector ARM name. Required. + :type collector_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + collector_name=collector_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/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_vmware_collectors_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_vmware_collectors_operations_operations.py new file mode 100644 index 000000000000..8807ec10a1a5 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_vmware_collectors_operations_operations.py @@ -0,0 +1,484 @@ +# 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._vmware_collectors_operations_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_assessment_project_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 VmwareCollectorsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`vmware_collectors_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> AsyncIterable["_models.VmwareCollector"]: + """List VmwareCollector resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either VmwareCollector or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.VmwareCollector] + :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.VmwareCollectorListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("VmwareCollectorListResult", 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, project_name: str, vm_ware_collector_name: str, **kwargs: Any + ) -> _models.VmwareCollector: + """Get a VmwareCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param vm_ware_collector_name: VMware collector ARM name. Required. + :type vm_ware_collector_name: str + :return: VmwareCollector or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.VmwareCollector + :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.VmwareCollector] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + vm_ware_collector_name=vm_ware_collector_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("VmwareCollector", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + project_name: str, + vm_ware_collector_name: str, + resource: Union[_models.VmwareCollector, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "VmwareCollector") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + vm_ware_collector_name=vm_ware_collector_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["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( + self, + resource_group_name: str, + project_name: str, + vm_ware_collector_name: str, + resource: _models.VmwareCollector, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VmwareCollector]: + """Create a VmwareCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param vm_ware_collector_name: VMware collector ARM name. Required. + :type vm_ware_collector_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.VmwareCollector + :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 VmwareCollector or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.VmwareCollector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + project_name: str, + vm_ware_collector_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VmwareCollector]: + """Create a VmwareCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param vm_ware_collector_name: VMware collector ARM name. Required. + :type vm_ware_collector_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either VmwareCollector or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.VmwareCollector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + project_name: str, + vm_ware_collector_name: str, + resource: Union[_models.VmwareCollector, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.VmwareCollector]: + """Create a VmwareCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param vm_ware_collector_name: VMware collector ARM name. Required. + :type vm_ware_collector_name: str + :param resource: Resource create parameters. Is either a VmwareCollector type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.migrationassessment.models.VmwareCollector or IO[bytes] + :return: An instance of AsyncLROPoller that returns either VmwareCollector or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.VmwareCollector] + :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.VmwareCollector] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + vm_ware_collector_name=vm_ware_collector_name, + resource=resource, + 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("VmwareCollector", 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.VmwareCollector].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.VmwareCollector]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def delete( + self, resource_group_name: str, project_name: str, vm_ware_collector_name: str, **kwargs: Any + ) -> None: + """Delete a VmwareCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param vm_ware_collector_name: VMware collector ARM name. Required. + :type vm_ware_collector_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + vm_ware_collector_name=vm_ware_collector_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/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_web_app_assessment_options_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_web_app_assessment_options_operations_operations.py new file mode 100644 index 000000000000..30e949b98f03 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_web_app_assessment_options_operations_operations.py @@ -0,0 +1,207 @@ +# 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._web_app_assessment_options_operations_operations import ( + build_get_request, + build_list_by_assessment_project_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 WebAppAssessmentOptionsOperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`web_app_assessment_options_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> AsyncIterable["_models.WebAppAssessmentOptions"]: + """List WebAppAssessmentOptions resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either WebAppAssessmentOptions or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.WebAppAssessmentOptions] + :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.WebAppAssessmentOptionsListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("WebAppAssessmentOptionsListResult", 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, project_name: str, assessment_options_name: str, **kwargs: Any + ) -> _models.WebAppAssessmentOptions: + """Get a WebAppAssessmentOptions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_options_name: Web app assessment options ARM name. Accepted values is + 'default'. Required. + :type assessment_options_name: str + :return: WebAppAssessmentOptions or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.WebAppAssessmentOptions + :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.WebAppAssessmentOptions] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_options_name=assessment_options_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("WebAppAssessmentOptions", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_web_app_assessment_v2_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_web_app_assessment_v2_operations_operations.py new file mode 100644 index 000000000000..10e7dba4bd87 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_web_app_assessment_v2_operations_operations.py @@ -0,0 +1,657 @@ +# 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._web_app_assessment_v2_operations_operations import ( + build_create_request, + build_delete_request, + build_download_url_request, + build_get_request, + build_list_by_group_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class WebAppAssessmentV2OperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`web_app_assessment_v2_operations` 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_group( + self, resource_group_name: str, project_name: str, group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.WebAppAssessmentV2"]: + """List WebAppAssessmentV2 resources by Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :return: An iterator like instance of either WebAppAssessmentV2 or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.WebAppAssessmentV2] + :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.WebAppAssessmentV2ListResult] = 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_group_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_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("WebAppAssessmentV2ListResult", 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, project_name: str, group_name: str, assessment_name: str, **kwargs: Any + ) -> _models.WebAppAssessmentV2: + """Get a WebAppAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Web app Assessment arm name. Required. + :type assessment_name: str + :return: WebAppAssessmentV2 or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.WebAppAssessmentV2 + :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.WebAppAssessmentV2] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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("WebAppAssessmentV2", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: Union[_models.WebAppAssessmentV2, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "WebAppAssessmentV2") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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["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( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: _models.WebAppAssessmentV2, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.WebAppAssessmentV2]: + """Create a WebAppAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Web app Assessment arm name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.WebAppAssessmentV2 + :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 WebAppAssessmentV2 or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.WebAppAssessmentV2] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.WebAppAssessmentV2]: + """Create a WebAppAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Web app Assessment arm name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either WebAppAssessmentV2 or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.WebAppAssessmentV2] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: Union[_models.WebAppAssessmentV2, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.WebAppAssessmentV2]: + """Create a WebAppAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Web app Assessment arm name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Is either a WebAppAssessmentV2 type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.migrationassessment.models.WebAppAssessmentV2 or IO[bytes] + :return: An instance of AsyncLROPoller that returns either WebAppAssessmentV2 or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.WebAppAssessmentV2] + :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.WebAppAssessmentV2] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + resource=resource, + 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("WebAppAssessmentV2", 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.WebAppAssessmentV2].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.WebAppAssessmentV2]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def delete( + self, resource_group_name: str, project_name: str, group_name: str, assessment_name: str, **kwargs: Any + ) -> None: + """Delete a WebAppAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Web app Assessment arm name. Required. + :type assessment_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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 + + async def _download_url_initial( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + body: JSON, + **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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _json = self._serialize.body(body, "object") + + _request = build_download_url_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_download_url( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + body: JSON, + **kwargs: Any + ) -> AsyncLROPoller[_models.DownloadUrl]: + """Get download URL for the assessment report. + + Get the URL for downloading the assessment in a report format. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Web app Assessment arm name. Required. + :type assessment_name: str + :param body: The content of the action request. Required. + :type body: JSON + :return: An instance of AsyncLROPoller that returns either DownloadUrl or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.DownloadUrl] + :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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.DownloadUrl] = 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._download_url_initial( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + body=body, + 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("DownloadUrl", 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.DownloadUrl].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DownloadUrl]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_web_app_assessment_v2_summary_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_web_app_assessment_v2_summary_operations_operations.py new file mode 100644 index 000000000000..5a847f564c91 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_web_app_assessment_v2_summary_operations_operations.py @@ -0,0 +1,224 @@ +# 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._web_app_assessment_v2_summary_operations_operations import ( + build_get_request, + build_list_by_web_app_assessment_v2_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 WebAppAssessmentV2SummaryOperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`web_app_assessment_v2_summary_operations` 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_web_app_assessment_v2( + self, resource_group_name: str, project_name: str, group_name: str, assessment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.WebAppAssessmentV2Summary"]: + """List WebAppAssessmentV2Summary resources by WebAppAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Web app Assessment arm name. Required. + :type assessment_name: str + :return: An iterator like instance of either WebAppAssessmentV2Summary or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.WebAppAssessmentV2Summary] + :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.WebAppAssessmentV2SummaryListResult] = 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_web_app_assessment_v2_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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("WebAppAssessmentV2SummaryListResult", 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, + project_name: str, + group_name: str, + assessment_name: str, + summary_name: str, + **kwargs: Any + ) -> _models.WebAppAssessmentV2Summary: + """Get a WebAppAssessmentV2Summary. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Web app Assessment arm name. Required. + :type assessment_name: str + :param summary_name: Gets the Name of the Web app Summary. Required. + :type summary_name: str + :return: WebAppAssessmentV2Summary or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.WebAppAssessmentV2Summary + :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.WebAppAssessmentV2Summary] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + summary_name=summary_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("WebAppAssessmentV2Summary", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_web_app_collector_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_web_app_collector_operations_operations.py new file mode 100644 index 000000000000..b85381a7e22a --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_web_app_collector_operations_operations.py @@ -0,0 +1,482 @@ +# 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._web_app_collector_operations_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_assessment_project_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 WebAppCollectorOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`web_app_collector_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> AsyncIterable["_models.WebAppCollector"]: + """List WebAppCollector resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either WebAppCollector or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.WebAppCollector] + :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.WebAppCollectorListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("WebAppCollectorListResult", 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, project_name: str, collector_name: str, **kwargs: Any + ) -> _models.WebAppCollector: + """Get a WebAppCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param collector_name: Web app collector ARM name. Required. + :type collector_name: str + :return: WebAppCollector or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.WebAppCollector + :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.WebAppCollector] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + collector_name=collector_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("WebAppCollector", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + project_name: str, + collector_name: str, + resource: Union[_models.WebAppCollector, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "WebAppCollector") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + collector_name=collector_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["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( + self, + resource_group_name: str, + project_name: str, + collector_name: str, + resource: _models.WebAppCollector, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.WebAppCollector]: + """Create a WebAppCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param collector_name: Web app collector ARM name. Required. + :type collector_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.WebAppCollector + :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 WebAppCollector or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.WebAppCollector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + project_name: str, + collector_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.WebAppCollector]: + """Create a WebAppCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param collector_name: Web app collector ARM name. Required. + :type collector_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either WebAppCollector or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.WebAppCollector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + project_name: str, + collector_name: str, + resource: Union[_models.WebAppCollector, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.WebAppCollector]: + """Create a WebAppCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param collector_name: Web app collector ARM name. Required. + :type collector_name: str + :param resource: Resource create parameters. Is either a WebAppCollector type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.migrationassessment.models.WebAppCollector or IO[bytes] + :return: An instance of AsyncLROPoller that returns either WebAppCollector or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.migrationassessment.models.WebAppCollector] + :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.WebAppCollector] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + collector_name=collector_name, + resource=resource, + 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("WebAppCollector", 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.WebAppCollector].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.WebAppCollector]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def delete(self, resource_group_name: str, project_name: str, collector_name: str, **kwargs: Any) -> None: + """Delete a WebAppCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param collector_name: Web app collector ARM name. Required. + :type collector_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + collector_name=collector_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/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_web_app_service_plan_v2_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_web_app_service_plan_v2_operations_operations.py new file mode 100644 index 000000000000..775ca24c9149 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/aio/operations/_web_app_service_plan_v2_operations_operations.py @@ -0,0 +1,245 @@ +# 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._web_app_service_plan_v2_operations_operations import ( + build_get_request, + build_list_by_web_app_assessment_v2_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 WebAppServicePlanV2OperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.aio.AzureMigrateAssessmentService`'s + :attr:`web_app_service_plan_v2_operations` 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_web_app_assessment_v2( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.WebAppServicePlanV2"]: + """List WebAppServicePlanV2 resources by WebAppAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Web app Assessment arm name. Required. + :type assessment_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either WebAppServicePlanV2 or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.migrationassessment.models.WebAppServicePlanV2] + :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.WebAppServicePlanV2ListResult] = 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_web_app_assessment_v2_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("WebAppServicePlanV2ListResult", 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, + project_name: str, + group_name: str, + assessment_name: str, + web_app_service_plan_name: str, + **kwargs: Any + ) -> _models.WebAppServicePlanV2: + """Get a WebAppServicePlanV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Web app Assessment arm name. Required. + :type assessment_name: str + :param web_app_service_plan_name: Web app service plan ARM name. Required. + :type web_app_service_plan_name: str + :return: WebAppServicePlanV2 or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.WebAppServicePlanV2 + :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.WebAppServicePlanV2] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + web_app_service_plan_name=web_app_service_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 + + 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("WebAppServicePlanV2", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/models/__init__.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/models/__init__.py new file mode 100644 index 000000000000..9a8a843f80e1 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/models/__init__.py @@ -0,0 +1,850 @@ +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AKSAssessment, + AKSAssessmentDetails, + AKSAssessmentListResult, + AKSAssessmentOptions, + AKSAssessmentOptionsListResult, + AKSAssessmentOptionsProperties, + AKSAssessmentProperties, + AKSAssessmentSettings, + AKSAssessmentSummary, + AKSCluster, + AKSClusterListResult, + AKSClusterProperties, + AKSCostDetail, + AKSCostDetailListResult, + AKSCostDetailProperties, + AKSSummary, + AKSSummaryListResult, + AKSSummaryProperties, + AppServiceSku, + AppSvcContainerSettings, + AppSvcNativeSettings, + AssessedDisk, + AssessedDiskData, + AssessedMachine, + AssessedMachineListResult, + AssessedMachineProperties, + AssessedNetworkAdapter, + AssessedSqlDatabaseV2, + AssessedSqlDatabaseV2ListResult, + AssessedSqlDatabaseV2Properties, + AssessedSqlInstanceDatabaseSummary, + AssessedSqlInstanceDiskDetails, + AssessedSqlInstanceStorageDetails, + AssessedSqlInstanceSummary, + AssessedSqlInstanceV2, + AssessedSqlInstanceV2ListResult, + AssessedSqlInstanceV2Properties, + AssessedSqlMachine, + AssessedSqlMachineListResult, + AssessedSqlMachineProperties, + AssessedSqlRecommendedEntity, + AssessedSqlRecommendedEntityListResult, + AssessedSqlRecommendedEntityProperties, + AssessedWebApp, + AssessedWebAppV2, + AssessedWebAppV2ListResult, + AssessedWebAppV2Properties, + AssessedWebApplication, + AssessedWebApplicationListResult, + AssessedWebApplicationProperties, + Assessment, + AssessmentDetails, + AssessmentListResult, + AssessmentOptions, + AssessmentOptionsListResult, + AssessmentOptionsProperties, + AssessmentProject, + AssessmentProjectListResult, + AssessmentProjectSummary, + AssessmentProjectSummaryListResult, + AssessmentProjectSummaryProperties, + AssessmentProjectUpdate, + AssessmentProjectUpdateProperties, + AssessmentPropertiesBase, + AssessmentResult, + AssessmentScopeParameters, + AssessmentSettings, + AvsAssessedDisk, + AvsAssessedMachine, + AvsAssessedMachineListResult, + AvsAssessedMachineProperties, + AvsAssessedNetworkAdapter, + AvsAssessment, + AvsAssessmentListResult, + AvsAssessmentOptions, + AvsAssessmentOptionsListResult, + AvsAssessmentOptionsProperties, + AvsAssessmentProperties, + AvsEstimatedExternalStorage, + AvsEstimatedNetwork, + AvsEstimatedNode, + AvsExternalStorageOptions, + AvsNodeSummary, + AvsSkuOptions, + AvsSummary, + AvsSummaryListResult, + AvsSummaryProperties, + AzureAppServiceContainerSummary, + AzureAppServiceSummary, + AzureArcManagementSettings, + AzureArcMonitoringSettings, + AzureArcSettings, + AzureAvsSummary, + AzureIaasSqlSummary, + AzureIaasSummary, + AzureIaasVmSummary, + AzureKubernetesServiceSummary, + AzureManagedDiskSkuDTO, + AzurePaasSummary, + AzureQuorumWitnessDTO, + AzureResourceProperties, + AzureResourceProperties2, + AzureSettings, + AzureSqlIaasSkuDTO, + AzureSqlPaasSkuDTO, + AzureSqlSummary, + AzureVirtualMachineSkuDTO, + BusinessCase, + BusinessCaseListResult, + BusinessCaseProperties, + Check, + Cluster, + CollectorAgentPropertiesBase, + CollectorAgentSpnPropertiesBase, + CollectorPropertiesBase, + CollectorPropertiesBaseWithAgent, + CompareSummary, + ComputeResource, + ComputeSettings, + CostByStorageType, + CostComponent, + CostDetails, + DiscoveredEntitiesSummary, + DiscoveredEntityLightSummary, + Disk, + DistributionByOperatingSystem, + DistributionByType, + DistributionByVirtualization, + DownloadUrl, + EntityUptime, + Error, + ErrorAdditionalInfo, + ErrorDetail, + ErrorDetailAutoGenerated, + ErrorResponse, + ErrorSummary, + EstimatedCostByOffer, + EstimatedCostByTarget, + EstimatedExternalStorage, + EstimatedNetwork, + EvaluatedAvsMachine, + EvaluatedAvsMachineListResult, + EvaluatedAvsMachineProperties, + EvaluatedMachine, + EvaluatedMachineListResult, + EvaluatedMachineProperties, + EvaluatedSqlEntity, + EvaluatedSqlEntityListResult, + EvaluatedSqlEntityProperties, + EvaluatedWebApp, + EvaluatedWebAppListResult, + EvaluatedWebAppProperties, + FacilitySettings, + Group, + GroupBodyProperties, + GroupListResult, + GroupProperties, + HypervCollector, + HypervCollectorListResult, + HypervLicense, + HypervVirtualizationManagementSettings, + IaasOsDistribution, + IaasOsLicensingDetails, + IaasSummary, + IaasSummaryListResult, + IaasSummaryProperties, + ImpactedAssessmentObject, + ImportCollector, + ImportCollectorListResult, + LaborSettings, + LinuxServerLicensingSettings, + Machine, + MachineAssessmentProperties, + MachineListResult, + MachineProperties, + ManagementCostComponent, + ManagementCostDetails, + ManagementSettings, + MigrationGuidelineContext, + MoreInfo, + MutableArmResource, + NetworkAdapter, + NetworkSettings, + NodePool, + OnPremiseSettings, + OnPremisesIaasSummary, + OnPremisesPaasLicensingCost, + OnPremisesPaasSummary, + OnPremisesSqlSummary, + OnPremisesWebAppSummary, + Operation, + OperationDisplay, + OperationListResult, + OptionsArmPropertiesBase, + OtherManagementCostsSettings, + OverviewSummary, + OverviewSummaryListResult, + OverviewSummaryProperties, + PaasDistribution, + PaasSummary, + PaasSummaryListResult, + PaasSummaryProperties, + PerfDataSettings, + PrivateEndpoint, + PrivateEndpointConnection, + PrivateEndpointConnectionListResult, + PrivateEndpointConnectionProperties, + PrivateLinkResource, + PrivateLinkResourceListResult, + PrivateLinkResourceProperties, + PrivateLinkServiceConnectionState, + ProcessorInfo, + ProductSupportStatus, + ProjectProperties, + ProxyResource, + RecommendationResult, + RecommendedAvsNodeTypeSummary, + RecommendedVmFamilySummary, + ReportDetails, + ReportDownloadUrl, + Resource, + ResourceId, + SecuritySettings, + ServerCollector, + ServerCollectorListResult, + ServersDiscovered, + ServicePackInsight, + Settings, + SharedResourcesDTO, + SqlAssessedNetworkAdapter, + SqlAssessmentMigrationIssue, + SqlAssessmentOptions, + SqlAssessmentOptionsListResult, + SqlAssessmentOptionsProperties, + SqlAssessmentV2, + SqlAssessmentV2IaasSuitabilityData, + SqlAssessmentV2ListResult, + SqlAssessmentV2PaasSuitabilityData, + SqlAssessmentV2Properties, + SqlAssessmentV2Summary, + SqlAssessmentV2SummaryData, + SqlAssessmentV2SummaryListResult, + SqlAssessmentV2SummaryProperties, + SqlAvailabilityGroupDataOverview, + SqlAvailabilityReplicaSummary, + SqlCollector, + SqlCollectorListResult, + SqlDbSettings, + SqlFCIMetadata, + SqlMiSettings, + SqlMigrationGuideline, + SqlPaaSTargetOptions, + SqlRecommendationReasoning, + SqlRecommendationReasoningContext, + SqlServerLicensingSettings, + SqlServiceTier, + SqlVersionDetails, + SqlVmSettings, + StorageSettings, + SuitabilityResult, + SummaryDetails, + SummaryPropertiesBase, + SupportStatusDistribution, + SystemData, + TargetSpecificResult, + TargetSpecificSummary, + ThirdPartyManagementSettings, + TrackedResource, + UltraDiskAssessmentOptions, + UpdateGroupBody, + UtilizationData, + VirtualizationSoftwareSettings, + VmFamilyOptions, + VmUptime, + VmwareCollector, + VmwareCollectorListResult, + VsphereLicense, + VsphereLicenseBase, + VsphereManagementLicense, + VsphereManagementSettings, + WebApp, + WebAppAssessmentOptions, + WebAppAssessmentOptionsListResult, + WebAppAssessmentOptionsProperties, + WebAppAssessmentV2, + WebAppAssessmentV2ListResult, + WebAppAssessmentV2Properties, + WebAppAssessmentV2Summary, + WebAppAssessmentV2SummaryListResult, + WebAppAssessmentV2SummaryProperties, + WebAppCollector, + WebAppCollectorListResult, + WebAppCollectorPropertiesBaseWithAgent, + WebAppDistribution, + WebAppMigrationIssues, + WebAppServicePlanV2, + WebAppServicePlanV2ListResult, + WebAppServicePlanV2Properties, + WebAppSkuDetails, + WebAppTargetOptions, + WebAppTargetSku, + WindowsServerLicensingSettings, + WorkloadSummary, + YearOnYearCost, + YearOnYearEstimates, +) + +from ._azure_migrate_assessment_service_enums import ( # type: ignore + ActionType, + ApiVersions, + AssessedMachineType, + AssessmentSizingCriterion, + AssessmentStage, + AssessmentStatus, + AssessmentType, + AsyncCommitModeIntent, + AvsAssessmentScenario, + AzureArcState, + AzureAvsNodeType, + AzureAvsSuitabilityExplanation, + AzureAvsVmSuitabilityDetail, + AzureAvsVmSuitabilityExplanation, + AzureCurrency, + AzureDiskSize, + AzureDiskSuitabilityDetail, + AzureDiskSuitabilityExplanation, + AzureDiskType, + AzureEnvironmentType, + AzureHybridUseBenefit, + AzureLocation, + AzureManagedDiskSkuDTODiskRedundancy, + AzureManagedDiskSkuDTODiskType, + AzureNetworkAdapterSuitabilityDetail, + AzureNetworkAdapterSuitabilityExplanation, + AzureOfferCode, + AzurePricingTier, + AzureQuorumWitnessDTOQuorumWitnessType, + AzureReservedInstance, + AzureSecurityOfferingType, + AzureSqlDataBaseType, + AzureSqlInstanceType, + AzureSqlPurchaseModel, + AzureSqlServiceTier, + AzureStorageRedundancy, + AzureVmCategory, + AzureVmFamily, + AzureVmSize, + AzureVmSuitabilityDetail, + AzureVmSuitabilityExplanation, + AzureWebAppSuitabilityIssueCategory, + AzureWebAppTargetType, + AzureWebAppTier, + BusinessCaseCurrency, + BusinessCaseState, + CheckResult, + CloudSuitability, + CompatibilityLevel, + ComputeTier, + ConsolidationType, + CostComponentName, + CreatedByType, + DiscoverySource, + EnvironmentType, + ExternalStorageType, + FttAndRaidLevel, + GroupStatus, + GroupType, + GroupUpdateOperation, + GuestOperatingSystemArchitecture, + HardwareGeneration, + HyperVLicenseType, + LicenseType, + LicensingProgram, + MachineBootType, + ManagementCostComponentName, + MigrationStrategy, + MultiSubnetIntent, + NetworkSkuType, + NodePoolMode, + OSType, + OptimizationLogic, + Origin, + OsLicense, + POSAzurePricingTier, + Percentile, + PricingTier, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + ProjectStatus, + ProvisioningState, + ProvisioningState2, + ProvisioningStatus, + Readiness, + RecommendedSuitability, + ReportStatus, + ReportType, + SavingsOption, + SavingsOptions, + SkuReplicationMode, + SqlAssessmentMigrationIssueCategory, + SqlFCIMetadataState, + SqlFCIState, + SqlMigrationGuidelineCategory, + SqlServerLicense, + SqlServerLicenseType, + SuggestedMigrationTool, + Suitability, + SupportabilityStatus, + TargetType, + TimeRange, + VsphereManagementLicenseType, + WebAppType, + WebAppTypes, + Year, +) +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AKSAssessment", + "AKSAssessmentDetails", + "AKSAssessmentListResult", + "AKSAssessmentOptions", + "AKSAssessmentOptionsListResult", + "AKSAssessmentOptionsProperties", + "AKSAssessmentProperties", + "AKSAssessmentSettings", + "AKSAssessmentSummary", + "AKSCluster", + "AKSClusterListResult", + "AKSClusterProperties", + "AKSCostDetail", + "AKSCostDetailListResult", + "AKSCostDetailProperties", + "AKSSummary", + "AKSSummaryListResult", + "AKSSummaryProperties", + "AppServiceSku", + "AppSvcContainerSettings", + "AppSvcNativeSettings", + "AssessedDisk", + "AssessedDiskData", + "AssessedMachine", + "AssessedMachineListResult", + "AssessedMachineProperties", + "AssessedNetworkAdapter", + "AssessedSqlDatabaseV2", + "AssessedSqlDatabaseV2ListResult", + "AssessedSqlDatabaseV2Properties", + "AssessedSqlInstanceDatabaseSummary", + "AssessedSqlInstanceDiskDetails", + "AssessedSqlInstanceStorageDetails", + "AssessedSqlInstanceSummary", + "AssessedSqlInstanceV2", + "AssessedSqlInstanceV2ListResult", + "AssessedSqlInstanceV2Properties", + "AssessedSqlMachine", + "AssessedSqlMachineListResult", + "AssessedSqlMachineProperties", + "AssessedSqlRecommendedEntity", + "AssessedSqlRecommendedEntityListResult", + "AssessedSqlRecommendedEntityProperties", + "AssessedWebApp", + "AssessedWebAppV2", + "AssessedWebAppV2ListResult", + "AssessedWebAppV2Properties", + "AssessedWebApplication", + "AssessedWebApplicationListResult", + "AssessedWebApplicationProperties", + "Assessment", + "AssessmentDetails", + "AssessmentListResult", + "AssessmentOptions", + "AssessmentOptionsListResult", + "AssessmentOptionsProperties", + "AssessmentProject", + "AssessmentProjectListResult", + "AssessmentProjectSummary", + "AssessmentProjectSummaryListResult", + "AssessmentProjectSummaryProperties", + "AssessmentProjectUpdate", + "AssessmentProjectUpdateProperties", + "AssessmentPropertiesBase", + "AssessmentResult", + "AssessmentScopeParameters", + "AssessmentSettings", + "AvsAssessedDisk", + "AvsAssessedMachine", + "AvsAssessedMachineListResult", + "AvsAssessedMachineProperties", + "AvsAssessedNetworkAdapter", + "AvsAssessment", + "AvsAssessmentListResult", + "AvsAssessmentOptions", + "AvsAssessmentOptionsListResult", + "AvsAssessmentOptionsProperties", + "AvsAssessmentProperties", + "AvsEstimatedExternalStorage", + "AvsEstimatedNetwork", + "AvsEstimatedNode", + "AvsExternalStorageOptions", + "AvsNodeSummary", + "AvsSkuOptions", + "AvsSummary", + "AvsSummaryListResult", + "AvsSummaryProperties", + "AzureAppServiceContainerSummary", + "AzureAppServiceSummary", + "AzureArcManagementSettings", + "AzureArcMonitoringSettings", + "AzureArcSettings", + "AzureAvsSummary", + "AzureIaasSqlSummary", + "AzureIaasSummary", + "AzureIaasVmSummary", + "AzureKubernetesServiceSummary", + "AzureManagedDiskSkuDTO", + "AzurePaasSummary", + "AzureQuorumWitnessDTO", + "AzureResourceProperties", + "AzureResourceProperties2", + "AzureSettings", + "AzureSqlIaasSkuDTO", + "AzureSqlPaasSkuDTO", + "AzureSqlSummary", + "AzureVirtualMachineSkuDTO", + "BusinessCase", + "BusinessCaseListResult", + "BusinessCaseProperties", + "Check", + "Cluster", + "CollectorAgentPropertiesBase", + "CollectorAgentSpnPropertiesBase", + "CollectorPropertiesBase", + "CollectorPropertiesBaseWithAgent", + "CompareSummary", + "ComputeResource", + "ComputeSettings", + "CostByStorageType", + "CostComponent", + "CostDetails", + "DiscoveredEntitiesSummary", + "DiscoveredEntityLightSummary", + "Disk", + "DistributionByOperatingSystem", + "DistributionByType", + "DistributionByVirtualization", + "DownloadUrl", + "EntityUptime", + "Error", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorDetailAutoGenerated", + "ErrorResponse", + "ErrorSummary", + "EstimatedCostByOffer", + "EstimatedCostByTarget", + "EstimatedExternalStorage", + "EstimatedNetwork", + "EvaluatedAvsMachine", + "EvaluatedAvsMachineListResult", + "EvaluatedAvsMachineProperties", + "EvaluatedMachine", + "EvaluatedMachineListResult", + "EvaluatedMachineProperties", + "EvaluatedSqlEntity", + "EvaluatedSqlEntityListResult", + "EvaluatedSqlEntityProperties", + "EvaluatedWebApp", + "EvaluatedWebAppListResult", + "EvaluatedWebAppProperties", + "FacilitySettings", + "Group", + "GroupBodyProperties", + "GroupListResult", + "GroupProperties", + "HypervCollector", + "HypervCollectorListResult", + "HypervLicense", + "HypervVirtualizationManagementSettings", + "IaasOsDistribution", + "IaasOsLicensingDetails", + "IaasSummary", + "IaasSummaryListResult", + "IaasSummaryProperties", + "ImpactedAssessmentObject", + "ImportCollector", + "ImportCollectorListResult", + "LaborSettings", + "LinuxServerLicensingSettings", + "Machine", + "MachineAssessmentProperties", + "MachineListResult", + "MachineProperties", + "ManagementCostComponent", + "ManagementCostDetails", + "ManagementSettings", + "MigrationGuidelineContext", + "MoreInfo", + "MutableArmResource", + "NetworkAdapter", + "NetworkSettings", + "NodePool", + "OnPremiseSettings", + "OnPremisesIaasSummary", + "OnPremisesPaasLicensingCost", + "OnPremisesPaasSummary", + "OnPremisesSqlSummary", + "OnPremisesWebAppSummary", + "Operation", + "OperationDisplay", + "OperationListResult", + "OptionsArmPropertiesBase", + "OtherManagementCostsSettings", + "OverviewSummary", + "OverviewSummaryListResult", + "OverviewSummaryProperties", + "PaasDistribution", + "PaasSummary", + "PaasSummaryListResult", + "PaasSummaryProperties", + "PerfDataSettings", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateEndpointConnectionProperties", + "PrivateLinkResource", + "PrivateLinkResourceListResult", + "PrivateLinkResourceProperties", + "PrivateLinkServiceConnectionState", + "ProcessorInfo", + "ProductSupportStatus", + "ProjectProperties", + "ProxyResource", + "RecommendationResult", + "RecommendedAvsNodeTypeSummary", + "RecommendedVmFamilySummary", + "ReportDetails", + "ReportDownloadUrl", + "Resource", + "ResourceId", + "SecuritySettings", + "ServerCollector", + "ServerCollectorListResult", + "ServersDiscovered", + "ServicePackInsight", + "Settings", + "SharedResourcesDTO", + "SqlAssessedNetworkAdapter", + "SqlAssessmentMigrationIssue", + "SqlAssessmentOptions", + "SqlAssessmentOptionsListResult", + "SqlAssessmentOptionsProperties", + "SqlAssessmentV2", + "SqlAssessmentV2IaasSuitabilityData", + "SqlAssessmentV2ListResult", + "SqlAssessmentV2PaasSuitabilityData", + "SqlAssessmentV2Properties", + "SqlAssessmentV2Summary", + "SqlAssessmentV2SummaryData", + "SqlAssessmentV2SummaryListResult", + "SqlAssessmentV2SummaryProperties", + "SqlAvailabilityGroupDataOverview", + "SqlAvailabilityReplicaSummary", + "SqlCollector", + "SqlCollectorListResult", + "SqlDbSettings", + "SqlFCIMetadata", + "SqlMiSettings", + "SqlMigrationGuideline", + "SqlPaaSTargetOptions", + "SqlRecommendationReasoning", + "SqlRecommendationReasoningContext", + "SqlServerLicensingSettings", + "SqlServiceTier", + "SqlVersionDetails", + "SqlVmSettings", + "StorageSettings", + "SuitabilityResult", + "SummaryDetails", + "SummaryPropertiesBase", + "SupportStatusDistribution", + "SystemData", + "TargetSpecificResult", + "TargetSpecificSummary", + "ThirdPartyManagementSettings", + "TrackedResource", + "UltraDiskAssessmentOptions", + "UpdateGroupBody", + "UtilizationData", + "VirtualizationSoftwareSettings", + "VmFamilyOptions", + "VmUptime", + "VmwareCollector", + "VmwareCollectorListResult", + "VsphereLicense", + "VsphereLicenseBase", + "VsphereManagementLicense", + "VsphereManagementSettings", + "WebApp", + "WebAppAssessmentOptions", + "WebAppAssessmentOptionsListResult", + "WebAppAssessmentOptionsProperties", + "WebAppAssessmentV2", + "WebAppAssessmentV2ListResult", + "WebAppAssessmentV2Properties", + "WebAppAssessmentV2Summary", + "WebAppAssessmentV2SummaryListResult", + "WebAppAssessmentV2SummaryProperties", + "WebAppCollector", + "WebAppCollectorListResult", + "WebAppCollectorPropertiesBaseWithAgent", + "WebAppDistribution", + "WebAppMigrationIssues", + "WebAppServicePlanV2", + "WebAppServicePlanV2ListResult", + "WebAppServicePlanV2Properties", + "WebAppSkuDetails", + "WebAppTargetOptions", + "WebAppTargetSku", + "WindowsServerLicensingSettings", + "WorkloadSummary", + "YearOnYearCost", + "YearOnYearEstimates", + "ActionType", + "ApiVersions", + "AssessedMachineType", + "AssessmentSizingCriterion", + "AssessmentStage", + "AssessmentStatus", + "AssessmentType", + "AsyncCommitModeIntent", + "AvsAssessmentScenario", + "AzureArcState", + "AzureAvsNodeType", + "AzureAvsSuitabilityExplanation", + "AzureAvsVmSuitabilityDetail", + "AzureAvsVmSuitabilityExplanation", + "AzureCurrency", + "AzureDiskSize", + "AzureDiskSuitabilityDetail", + "AzureDiskSuitabilityExplanation", + "AzureDiskType", + "AzureEnvironmentType", + "AzureHybridUseBenefit", + "AzureLocation", + "AzureManagedDiskSkuDTODiskRedundancy", + "AzureManagedDiskSkuDTODiskType", + "AzureNetworkAdapterSuitabilityDetail", + "AzureNetworkAdapterSuitabilityExplanation", + "AzureOfferCode", + "AzurePricingTier", + "AzureQuorumWitnessDTOQuorumWitnessType", + "AzureReservedInstance", + "AzureSecurityOfferingType", + "AzureSqlDataBaseType", + "AzureSqlInstanceType", + "AzureSqlPurchaseModel", + "AzureSqlServiceTier", + "AzureStorageRedundancy", + "AzureVmCategory", + "AzureVmFamily", + "AzureVmSize", + "AzureVmSuitabilityDetail", + "AzureVmSuitabilityExplanation", + "AzureWebAppSuitabilityIssueCategory", + "AzureWebAppTargetType", + "AzureWebAppTier", + "BusinessCaseCurrency", + "BusinessCaseState", + "CheckResult", + "CloudSuitability", + "CompatibilityLevel", + "ComputeTier", + "ConsolidationType", + "CostComponentName", + "CreatedByType", + "DiscoverySource", + "EnvironmentType", + "ExternalStorageType", + "FttAndRaidLevel", + "GroupStatus", + "GroupType", + "GroupUpdateOperation", + "GuestOperatingSystemArchitecture", + "HardwareGeneration", + "HyperVLicenseType", + "LicenseType", + "LicensingProgram", + "MachineBootType", + "ManagementCostComponentName", + "MigrationStrategy", + "MultiSubnetIntent", + "NetworkSkuType", + "NodePoolMode", + "OSType", + "OptimizationLogic", + "Origin", + "OsLicense", + "POSAzurePricingTier", + "Percentile", + "PricingTier", + "PrivateEndpointConnectionProvisioningState", + "PrivateEndpointServiceConnectionStatus", + "ProjectStatus", + "ProvisioningState", + "ProvisioningState2", + "ProvisioningStatus", + "Readiness", + "RecommendedSuitability", + "ReportStatus", + "ReportType", + "SavingsOption", + "SavingsOptions", + "SkuReplicationMode", + "SqlAssessmentMigrationIssueCategory", + "SqlFCIMetadataState", + "SqlFCIState", + "SqlMigrationGuidelineCategory", + "SqlServerLicense", + "SqlServerLicenseType", + "SuggestedMigrationTool", + "Suitability", + "SupportabilityStatus", + "TargetType", + "TimeRange", + "VsphereManagementLicenseType", + "WebAppType", + "WebAppTypes", + "Year", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/models/_azure_migrate_assessment_service_enums.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/models/_azure_migrate_assessment_service_enums.py new file mode 100644 index 000000000000..229beabc28e2 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/models/_azure_migrate_assessment_service_enums.py @@ -0,0 +1,1973 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" + + INTERNAL = "Internal" + + +class ApiVersions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Common API Versions for Assessment Project Tracked Resource.""" + + V2019_10_01 = "2019-10-01" + """2019-10-01 API Version.""" + V2020_01_01 = "2020-01-01" + """2020-01-01 API Version.""" + V2020_05_01_PREVIEW = "2020-05-01-preview" + """2020-05-01-preview API Version.""" + V2022_02_02_PREVIEW = "2022-02-02-preview" + """2022-02-02-preview API Version.""" + V2022_08_01_PREVIEW = "2022-08-01-preview" + """2022-08-01-preview API Version.""" + V2023_03_03 = "2023-03-03" + """2023-03-03 API Version.""" + V2023_03_15 = "2023-03-15" + """2023-03-15 API Version.""" + V2023_04_01_PREVIEW = "2023-04-01-preview" + """2023-04-01-preview API Version.""" + V2023_05_01_PREVIEW = "2023-05-01-preview" + """2023-05-01-preview API Version.""" + V2023_07_07_PREVIEW = "2023-07-07-preview" + """2023-07-07-preview API Version.""" + V2023_09_09_PREVIEW = "2023-09-09-preview" + """2023-09-09-preview API Version.""" + V2024_01_01_PREVIEW = "2024-01-01-preview" + """2024-01-01-preview API Version.""" + + +class AssessedMachineType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AssessedMachineType.""" + + UNKNOWN = "Unknown" + ASSESSED_MACHINE = "AssessedMachine" + AVS_ASSESSED_MACHINE = "AvsAssessedMachine" + SQL_ASSESSED_MACHINE = "SqlAssessedMachine" + + +class AssessmentSizingCriterion(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Assessment Sizing Criteria.""" + + PERFORMANCE_BASED = "PerformanceBased" + """Performance Data based Sizing.""" + AS_ON_PREMISES = "AsOnPremises" + """As On Premises or Static Data based Sizing.""" + + +class AssessmentStage(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AssessmentStage.""" + + IN_PROGRESS = "InProgress" + UNDER_REVIEW = "UnderReview" + APPROVED = "Approved" + + +class AssessmentStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Assessment Status.""" + + CREATED = "Created" + """Assessment is Created.""" + UPDATED = "Updated" + """Assessment is Updated.""" + RUNNING = "Running" + """Assessment is currently running.""" + COMPLETED = "Completed" + """Assessment is Completed or Ready.""" + INVALID = "Invalid" + """Assessment is Failed i.e. it is now invalid.""" + OUT_OF_SYNC = "OutOfSync" + """Assessment is Out of Sync.""" + OUT_DATED = "OutDated" + """Assessment is Out Dated.""" + DELETED = "Deleted" + """Assessment is Deleted.""" + + +class AssessmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AssessmentType.""" + + UNKNOWN = "Unknown" + MACHINE_ASSESSMENT = "MachineAssessment" + AVS_ASSESSMENT = "AvsAssessment" + SQL_ASSESSMENT = "SqlAssessment" + WEB_APP_ASSESSMENT = "WebAppAssessment" + + +class AsyncCommitModeIntent(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AsyncCommitModeIntent.""" + + NONE = "None" + HIGH_AVAILABILITY = "HighAvailability" + DISASTER_RECOVERY = "DisasterRecovery" + + +class AvsAssessmentScenario(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Scenarios with which Avs Assessments can be created.""" + + UNKNOWN = "Unknown" + """Unknown assessment scenario""" + NEW_AVS_SDDC = "NewAvsSddc" + """Create Assessment for new Avs Sddc""" + AVS_SDDC_EXPANSION = "AvsSddcExpansion" + """Create Assessment for existing Avs Sddc""" + + +class AzureArcState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureArc state values.""" + + DISABLED = "Disabled" + """AzureArc state disabled.""" + ENABLED = "Enabled" + """AzureArc state enabled.""" + UNKNOWN = "Unknown" + """AzureArc state unknown.""" + + +class AzureAvsNodeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureAvsNodeType.""" + + UNKNOWN = "Unknown" + AV36 = "AV36" + AV36_P = "AV36P" + AV52 = "AV52" + AV64 = "AV64" + + +class AzureAvsSuitabilityExplanation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureAvsSuitabilityExplanation.""" + + UNKNOWN = "Unknown" + NOT_APPLICABLE = "NotApplicable" + UNSUPPORTED_LOCATION_FOR_SELECTED_NODE = "UnsupportedLocationForSelectedNode" + INTERNAL_ERROR_IN_RECOMMENDATION = "InternalErrorInRecommendation" + UNSUPPORTED_LOCATION_FOR_SELECTED_EXTERNAL_STORAGE_TYPES = "UnsupportedLocationForSelectedExternalStorageTypes" + + +class AzureAvsVmSuitabilityDetail(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureAvsVmSuitabilityDetail.""" + + NONE = "None" + PERCENTAGE_OF_CORES_UTILIZED_MISSING = "PercentageOfCoresUtilizedMissing" + PERCENTAGE_OF_MEMORY_UTILIZED_MISSING = "PercentageOfMemoryUtilizedMissing" + PERCENTAGE_OF_CORES_UTILIZED_OUT_OF_RANGE = "PercentageOfCoresUtilizedOutOfRange" + PERCENTAGE_OF_MEMORY_UTILIZED_OUT_OF_RANGE = "PercentageOfMemoryUtilizedOutOfRange" + PERCENTAGE_OF_STORAGE_UTILIZED_OUT_OF_RANGE = "PercentageOfStorageUtilizedOutOfRange" + + +class AzureAvsVmSuitabilityExplanation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureAvsVmSuitabilityExplanation.""" + + UNKNOWN = "Unknown" + NOT_APPLICABLE = "NotApplicable" + IP_V6_NOT_SUPPORTED = "IpV6NotSupported" + UNSUPPORTED_OPERATING_SYSTEM = "UnsupportedOperatingSystem" + + +class AzureCurrency(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Currency for Azure.""" + + UNKNOWN = "Unknown" + USD = "USD" + DKK = "DKK" + CAD = "CAD" + IDR = "IDR" + JPY = "JPY" + KRW = "KRW" + NZD = "NZD" + NOK = "NOK" + RUB = "RUB" + SAR = "SAR" + ZAR = "ZAR" + SEK = "SEK" + TRY = "TRY" + GBP = "GBP" + MXN = "MXN" + MYR = "MYR" + INR = "INR" + HKD = "HKD" + BRL = "BRL" + TWD = "TWD" + EUR = "EUR" + CHF = "CHF" + ARS = "ARS" + AUD = "AUD" + CNY = "CNY" + TRY_ENUM = "TRY" + + +class AzureDiskSize(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureDiskSize.""" + + UNKNOWN = "Unknown" + STANDARD_S4 = "Standard_S4" + STANDARD_S6 = "Standard_S6" + STANDARD_S10 = "Standard_S10" + STANDARD_S15 = "Standard_S15" + STANDARD_S20 = "Standard_S20" + STANDARD_S30 = "Standard_S30" + STANDARD_S40 = "Standard_S40" + STANDARD_S50 = "Standard_S50" + STANDARD_S60 = "Standard_S60" + STANDARD_S70 = "Standard_S70" + STANDARD_S80 = "Standard_S80" + PREMIUM_P4 = "Premium_P4" + PREMIUM_P6 = "Premium_P6" + PREMIUM_P10 = "Premium_P10" + PREMIUM_P15 = "Premium_P15" + PREMIUM_P20 = "Premium_P20" + PREMIUM_P30 = "Premium_P30" + PREMIUM_P40 = "Premium_P40" + PREMIUM_P50 = "Premium_P50" + PREMIUM_P60 = "Premium_P60" + PREMIUM_P70 = "Premium_P70" + PREMIUM_P80 = "Premium_P80" + STANDARD_SSDE10 = "StandardSSD_E10" + STANDARD_SSDE15 = "StandardSSD_E15" + STANDARD_SSDE20 = "StandardSSD_E20" + STANDARD_SSDE30 = "StandardSSD_E30" + STANDARD_SSDE40 = "StandardSSD_E40" + STANDARD_SSDE50 = "StandardSSD_E50" + STANDARD_SSDE60 = "StandardSSD_E60" + STANDARD_SSDE70 = "StandardSSD_E70" + STANDARD_SSDE80 = "StandardSSD_E80" + STANDARD_SSDE4 = "StandardSSD_E4" + STANDARD_SSDE6 = "StandardSSD_E6" + STANDARD_SSDE1 = "StandardSSD_E1" + STANDARD_SSDE2 = "StandardSSD_E2" + STANDARD_SSDE3 = "StandardSSD_E3" + PREMIUM_P1 = "Premium_P1" + PREMIUM_P2 = "Premium_P2" + PREMIUM_P3 = "Premium_P3" + ULTRA = "Ultra" + PREMIUM_V2 = "PremiumV2" + + +class AzureDiskSuitabilityDetail(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureDiskSuitabilityDetail.""" + + NONE = "None" + NUMBER_OF_READ_OPERATIONS_PER_SECOND_MISSING = "NumberOfReadOperationsPerSecondMissing" + NUMBER_OF_WRITE_OPERATIONS_PER_SECOND_MISSING = "NumberOfWriteOperationsPerSecondMissing" + MEGABYTES_PER_SECOND_OF_READ_MISSING = "MegabytesPerSecondOfReadMissing" + MEGABYTES_PER_SECOND_OF_WRITE_MISSING = "MegabytesPerSecondOfWriteMissing" + DISK_GIGABYTES_CONSUMED_MISSING = "DiskGigabytesConsumedMissing" + DISK_GIGABYTES_PROVISIONED_MISSING = "DiskGigabytesProvisionedMissing" + NUMBER_OF_READ_OPERATIONS_PER_SECOND_OUT_OF_RANGE = "NumberOfReadOperationsPerSecondOutOfRange" + NUMBER_OF_WRITE_OPERATIONS_PER_SECOND_OUT_OF_RANGE = "NumberOfWriteOperationsPerSecondOutOfRange" + MEGABYTES_PER_SECOND_OF_READ_OUT_OF_RANGE = "MegabytesPerSecondOfReadOutOfRange" + MEGABYTES_PER_SECOND_OF_WRITE_OUT_OF_RANGE = "MegabytesPerSecondOfWriteOutOfRange" + DISK_GIGABYTES_CONSUMED_OUT_OF_RANGE = "DiskGigabytesConsumedOutOfRange" + DISK_GIGABYTES_PROVISIONED_OUT_OF_RANGE = "DiskGigabytesProvisionedOutOfRange" + + +class AzureDiskSuitabilityExplanation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureDiskSuitabilityExplanation.""" + + UNKNOWN = "Unknown" + NOT_APPLICABLE = "NotApplicable" + DISK_SIZE_GREATER_THAN_SUPPORTED = "DiskSizeGreaterThanSupported" + NO_SUITABLE_DISK_SIZE_FOR_IOPS = "NoSuitableDiskSizeForIops" + NO_SUITABLE_DISK_SIZE_FOR_THROUGHPUT = "NoSuitableDiskSizeForThroughput" + NO_DISK_SIZE_FOUND_IN_SELECTED_LOCATION = "NoDiskSizeFoundInSelectedLocation" + NO_DISK_SIZE_FOUND_FOR_SELECTED_REDUNDANCY = "NoDiskSizeFoundForSelectedRedundancy" + INTERNAL_ERROR_OCCURRED_FOR_DISK_EVALUATION = "InternalErrorOccurredForDiskEvaluation" + NO_EA_PRICE_FOUND_FOR_DISK_SIZE = "NoEaPriceFoundForDiskSize" + + +class AzureDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureDiskType.""" + + UNKNOWN = "Unknown" + STANDARD = "Standard" + STANDARD_SSD = "StandardSSD" + PREMIUM = "Premium" + STANDARD_OR_PREMIUM = "StandardOrPremium" + ULTRA = "Ultra" + PREMIUM_V2 = "PremiumV2" + + +class AzureEnvironmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Environment Type for Azure.""" + + UNKNOWN = "Unknown" + """Unknown. Indicates missing data.""" + DEV_TEST = "DevTest" + """Development or Test Environment.""" + PRODUCTION = "Production" + """Production Environment.""" + + +class AzureHybridUseBenefit(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureHybridUseBenefit.""" + + UNKNOWN = "Unknown" + YES = "Yes" + NO = "No" + + +class AzureLocation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Location for Azure.""" + + UNKNOWN = "Unknown" + EAST_ASIA = "EastAsia" + SOUTHEAST_ASIA = "SoutheastAsia" + AUSTRALIA_EAST = "AustraliaEast" + AUSTRALIA_SOUTHEAST = "AustraliaSoutheast" + BRAZIL_SOUTH = "BrazilSouth" + CANADA_CENTRAL = "CanadaCentral" + CANADA_EAST = "CanadaEast" + WEST_EUROPE = "WestEurope" + NORTH_EUROPE = "NorthEurope" + CENTRAL_INDIA = "CentralIndia" + SOUTH_INDIA = "SouthIndia" + WEST_INDIA = "WestIndia" + JAPAN_EAST = "JapanEast" + JAPAN_WEST = "JapanWest" + KOREA_CENTRAL = "KoreaCentral" + KOREA_SOUTH = "KoreaSouth" + UK_WEST = "UkWest" + UK_SOUTH = "UkSouth" + NORTH_CENTRAL_US = "NorthCentralUs" + EAST_US = "EastUs" + WEST_US2 = "WestUs2" + SOUTH_CENTRAL_US = "SouthCentralUs" + CENTRAL_US = "CentralUs" + EAST_US2 = "EastUs2" + WEST_US = "WestUs" + WEST_CENTRAL_US = "WestCentralUs" + GERMANY_CENTRAL = "GermanyCentral" + GERMANY_NORTHEAST = "GermanyNortheast" + CHINA_NORTH = "ChinaNorth" + CHINA_EAST = "ChinaEast" + US_GOV_ARIZONA = "USGovArizona" + US_GOV_TEXAS = "USGovTexas" + US_GOV_IOWA = "USGovIowa" + US_GOV_VIRGINIA = "USGovVirginia" + US_DO_D_CENTRAL = "USDoDCentral" + US_DO_D_EAST = "USDoDEast" + FRANCE_CENTRAL = "FranceCentral" + AUSTRALIA_CENTRAL = "AustraliaCentral" + SOUTH_AFRICA_NORTH = "SouthAfricaNorth" + FRANCE_SOUTH = "FranceSouth" + AUSTRALIA_CENTRAL2 = "AustraliaCentral2" + SOUTH_AFRICA_WEST = "SouthAfricaWest" + GERMANY_NORTH = "GermanyNorth" + GERMANY_WEST_CENTRAL = "GermanyWestCentral" + NORWAY_EAST = "NorwayEast" + NORWAY_WEST = "NorwayWest" + CHINA_EAST2 = "ChinaEast2" + CHINA_NORTH2 = "ChinaNorth2" + SWITZERLAND_NORTH = "SwitzerlandNorth" + SWITZERLAND_WEST = "SwitzerlandWest" + UAE_NORTH = "UAENorth" + UAE_CENTRAL = "UAECentral" + US_NAT_EAST = "UsNatEast" + US_NAT_WEST = "UsNatWest" + US_SEC_EAST = "UsSecEast" + US_SEC_CENTRAL = "UsSecCentral" + US_SEC_WEST = "UsSecWest" + SWEDEN_CENTRAL = "SwedenCentral" + QATAR_CENTRAL = "QatarCentral" + + +class AzureManagedDiskSkuDTODiskRedundancy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureManagedDiskSkuDTODiskRedundancy.""" + + UNKNOWN = "Unknown" + LRS = "LRS" + ZRS = "ZRS" + + +class AzureManagedDiskSkuDTODiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureManagedDiskSkuDTODiskType.""" + + UNKNOWN = "Unknown" + STANDARD = "Standard" + STANDARD_SSD = "StandardSSD" + PREMIUM = "Premium" + STANDARD_OR_PREMIUM = "StandardOrPremium" + ULTRA = "Ultra" + PREMIUM_V2 = "PremiumV2" + + +class AzureNetworkAdapterSuitabilityDetail(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureNetworkAdapterSuitabilityDetail.""" + + NONE = "None" + MEGABYTES_OF_DATA_TRANSMITTED_MISSING = "MegabytesOfDataTransmittedMissing" + MEGABYTES_OF_DATA_TRANSMITTED_OUT_OF_RANGE = "MegabytesOfDataTransmittedOutOfRange" + MEGABYTES_OF_DATA_RECIEVED_MISSING = "MegabytesOfDataRecievedMissing" + MEGABYTES_OF_DATA_RECIEVED_OUT_OF_RANGE = "MegabytesOfDataRecievedOutOfRange" + + +class AzureNetworkAdapterSuitabilityExplanation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureNetworkAdapterSuitabilityExplanation.""" + + UNKNOWN = "Unknown" + NOT_APPLICABLE = "NotApplicable" + INTERNAL_ERROR_OCCURRED = "InternalErrorOccurred" + + +class AzureOfferCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureOfferCode.""" + + UNKNOWN = "Unknown" + MSAZR0003_P = "MSAZR0003P" + MSAZR0044_P = "MSAZR0044P" + MSAZR0059_P = "MSAZR0059P" + MSAZR0060_P = "MSAZR0060P" + MSAZR0062_P = "MSAZR0062P" + MSAZR0063_P = "MSAZR0063P" + MSAZR0064_P = "MSAZR0064P" + MSAZR0029_P = "MSAZR0029P" + MSAZR0022_P = "MSAZR0022P" + MSAZR0023_P = "MSAZR0023P" + MSAZR0148_P = "MSAZR0148P" + MSAZR0025_P = "MSAZR0025P" + MSAZR0036_P = "MSAZR0036P" + MSAZR0120_P = "MSAZR0120P" + MSAZR0121_P = "MSAZR0121P" + MSAZR0122_P = "MSAZR0122P" + MSAZR0123_P = "MSAZR0123P" + MSAZR0124_P = "MSAZR0124P" + MSAZR0125_P = "MSAZR0125P" + MSAZR0126_P = "MSAZR0126P" + MSAZR0127_P = "MSAZR0127P" + MSAZR0128_P = "MSAZR0128P" + MSAZR0129_P = "MSAZR0129P" + MSAZR0130_P = "MSAZR0130P" + MSAZR0111_P = "MSAZR0111P" + MSAZR0144_P = "MSAZR0144P" + MSAZR0149_P = "MSAZR0149P" + MSMCAZR0044_P = "MSMCAZR0044P" + MSMCAZR0059_P = "MSMCAZR0059P" + MSMCAZR0060_P = "MSMCAZR0060P" + MSMCAZR0063_P = "MSMCAZR0063P" + MSMCAZR0120_P = "MSMCAZR0120P" + MSMCAZR0121_P = "MSMCAZR0121P" + MSMCAZR0125_P = "MSMCAZR0125P" + MSMCAZR0128_P = "MSMCAZR0128P" + MSAZRDE0003_P = "MSAZRDE0003P" + MSAZRDE0044_P = "MSAZRDE0044P" + MSAZRUSGOV0003_P = "MSAZRUSGOV0003P" + EA = "EA" + MSAZR0243_P = "MSAZR0243P" + SAVINGS_PLAN1_YEAR = "SavingsPlan1Year" + SAVINGS_PLAN3_YEAR = "SavingsPlan3Year" + + +class AzurePricingTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzurePricingTier.""" + + STANDARD = "Standard" + BASIC = "Basic" + + +class AzureQuorumWitnessDTOQuorumWitnessType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureQuorumWitnessDTOQuorumWitnessType.""" + + UNKNOWN = "Unknown" + CLOUD = "Cloud" + DISK = "Disk" + + +class AzureReservedInstance(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureReservedInstance.""" + + NONE = "None" + RI1_YEAR = "RI1Year" + RI3_YEAR = "RI3Year" + + +class AzureSecurityOfferingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureSecurityOfferingType.""" + + NO = "NO" + MDC = "MDC" + + +class AzureSqlDataBaseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureSqlDataBaseType.""" + + UNKNOWN = "Unknown" + AUTOMATIC = "Automatic" + SINGLE_DATABASE = "SingleDatabase" + ELASTIC_POOL = "ElasticPool" + + +class AzureSqlInstanceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureSqlInstanceType.""" + + UNKNOWN = "Unknown" + AUTOMATIC = "Automatic" + SINGLE_INSTANCE = "SingleInstance" + INSTANCE_POOLS = "InstancePools" + + +class AzureSqlPurchaseModel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureSqlPurchaseModel.""" + + UNKNOWN = "Unknown" + V_CORE = "VCore" + DTU = "DTU" + + +class AzureSqlServiceTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureSqlServiceTier.""" + + UNKNOWN = "Unknown" + AUTOMATIC = "Automatic" + GENERAL_PURPOSE = "GeneralPurpose" + BUSINESS_CRITICAL = "BusinessCritical" + HYPER_SCALE = "HyperScale" + + +class AzureStorageRedundancy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureStorageRedundancy.""" + + UNKNOWN = "Unknown" + LOCALLY_REDUNDANT = "LocallyRedundant" + ZONE_REDUNDANT = "ZoneRedundant" + GEO_REDUNDANT = "GeoRedundant" + READ_ACCESS_GEO_REDUNDANT = "ReadAccessGeoRedundant" + + +class AzureVmCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Azure VM Category.""" + + ALL = "All" + """Indicates All categories of VM.""" + COMPUTE_OPTIMIZED = "ComputeOptimized" + """Compute Optimized.""" + GENERAL_PURPOSE = "GeneralPurpose" + """General Purpose.""" + GPU_OPTIMIZED = "GpuOptimized" + """GPU Optimized.""" + HIGH_PERFORMANCE_COMPUTE = "HighPerformanceCompute" + """High Performance Compute.""" + MEMORY_OPTIMIZED = "MemoryOptimized" + """Memory Optimized.""" + STORAGE_OPTIMIZED = "StorageOptimized" + """Storage Optimized.""" + ISOLATED = "Isolated" + """Isolated VM.""" + + +class AzureVmFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureVmFamily.""" + + UNKNOWN = "Unknown" + BASIC_A0_A4 = "Basic_A0_A4" + STANDARD_A0_A7 = "Standard_A0_A7" + STANDARD_A8_A11 = "Standard_A8_A11" + AV2_SERIES = "Av2_series" + D_SERIES = "D_series" + DV2_SERIES = "Dv2_series" + DS_SERIES = "DS_series" + D_SV2_SERIES = "DSv2_series" + F_SERIES = "F_series" + FS_SERIES = "Fs_series" + G_SERIES = "G_series" + GS_SERIES = "GS_series" + H_SERIES = "H_series" + LS_SERIES = "Ls_series" + DSV3_SERIES = "Dsv3_series" + DV3_SERIES = "Dv3_series" + FSV2_SERIES = "Fsv2_series" + EV3_SERIES = "Ev3_series" + ESV3_SERIES = "Esv3_series" + M_SERIES = "M_series" + DC_SERIES = "DC_Series" + LSV2_SERIES = "Lsv2_series" + EV4_SERIES = "Ev4_series" + ESV4_SERIES = "Esv4_series" + EDV4_SERIES = "Edv4_series" + EDSV4_SERIES = "Edsv4_series" + DV4_SERIES = "Dv4_series" + DSV4_SERIES = "Dsv4_series" + DDV4_SERIES = "Ddv4_series" + DDSV4_SERIES = "Ddsv4_series" + EASV4_SERIES = "Easv4_series" + DASV4_SERIES = "Dasv4_series" + MV2_SERIES = "Mv2_series" + EAV4_SERIES = "Eav4_series" + DAV4_SERIES = "Dav4_series" + MSV2_SERIES = "Msv2_series" + MDSV2_SERIES = "Mdsv2_series" + DV5_SERIES = "Dv5_series" + DSV5_SERIES = "Dsv5_series" + DDV5_SERIES = "Ddv5_series" + DDSV5_SERIES = "Ddsv5_series" + DASV5_SERIES = "Dasv5_series" + DADSV5_SERIES = "Dadsv5_series" + EV5_SERIES = "Ev5_series" + ESV5_SERIES = "Esv5_series" + EDV5_SERIES = "Edv5_series" + EDSV5_SERIES = "Edsv5_series" + EASV5_SERIES = "Easv5_series" + EADSV5_SERIES = "Eadsv5_series" + EBSV5_SERIES = "Ebsv5_series" + EBDSV5_SERIES = "Ebdsv5_series" + + +class AzureVmSize(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureVmSize.""" + + UNKNOWN = "Unknown" + BASIC_A0 = "Basic_A0" + BASIC_A1 = "Basic_A1" + BASIC_A2 = "Basic_A2" + BASIC_A3 = "Basic_A3" + BASIC_A4 = "Basic_A4" + STANDARD_A0 = "Standard_A0" + STANDARD_A1 = "Standard_A1" + STANDARD_A2 = "Standard_A2" + STANDARD_A3 = "Standard_A3" + STANDARD_A4 = "Standard_A4" + STANDARD_A5 = "Standard_A5" + STANDARD_A6 = "Standard_A6" + STANDARD_A7 = "Standard_A7" + STANDARD_A8 = "Standard_A8" + STANDARD_A9 = "Standard_A9" + STANDARD_A10 = "Standard_A10" + STANDARD_A11 = "Standard_A11" + STANDARD_A1_V2 = "Standard_A1_v2" + STANDARD_A2_V2 = "Standard_A2_v2" + STANDARD_A4_V2 = "Standard_A4_v2" + STANDARD_A8_V2 = "Standard_A8_v2" + STANDARD_A2_MV2 = "Standard_A2m_v2" + STANDARD_A4_MV2 = "Standard_A4m_v2" + STANDARD_A8_MV2 = "Standard_A8m_v2" + STANDARD_D1 = "Standard_D1" + STANDARD_D2 = "Standard_D2" + STANDARD_D3 = "Standard_D3" + STANDARD_D4 = "Standard_D4" + STANDARD_D11 = "Standard_D11" + STANDARD_D12 = "Standard_D12" + STANDARD_D13 = "Standard_D13" + STANDARD_D14 = "Standard_D14" + STANDARD_D1_V2 = "Standard_D1_v2" + STANDARD_D2_V2 = "Standard_D2_v2" + STANDARD_D3_V2 = "Standard_D3_v2" + STANDARD_D4_V2 = "Standard_D4_v2" + STANDARD_D5_V2 = "Standard_D5_v2" + STANDARD_D11_V2 = "Standard_D11_v2" + STANDARD_D12_V2 = "Standard_D12_v2" + STANDARD_D13_V2 = "Standard_D13_v2" + STANDARD_D14_V2 = "Standard_D14_v2" + STANDARD_D15_V2 = "Standard_D15_v2" + STANDARD_DS1 = "Standard_DS1" + STANDARD_DS2 = "Standard_DS2" + STANDARD_DS3 = "Standard_DS3" + STANDARD_DS4 = "Standard_DS4" + STANDARD_DS11 = "Standard_DS11" + STANDARD_DS12 = "Standard_DS12" + STANDARD_DS13 = "Standard_DS13" + STANDARD_DS14 = "Standard_DS14" + STANDARD_DS1_V2 = "Standard_DS1_v2" + STANDARD_DS2_V2 = "Standard_DS2_v2" + STANDARD_DS3_V2 = "Standard_DS3_v2" + STANDARD_DS4_V2 = "Standard_DS4_v2" + STANDARD_DS5_V2 = "Standard_DS5_v2" + STANDARD_DS11_V2 = "Standard_DS11_v2" + STANDARD_DS12_V2 = "Standard_DS12_v2" + STANDARD_DS13_V2 = "Standard_DS13_v2" + STANDARD_DS14_V2 = "Standard_DS14_v2" + STANDARD_DS15_V2 = "Standard_DS15_v2" + STANDARD_F1 = "Standard_F1" + STANDARD_F2 = "Standard_F2" + STANDARD_F4 = "Standard_F4" + STANDARD_F8 = "Standard_F8" + STANDARD_F16 = "Standard_F16" + STANDARD_F1_S = "Standard_F1s" + STANDARD_F2_S = "Standard_F2s" + STANDARD_F4_S = "Standard_F4s" + STANDARD_F8_S = "Standard_F8s" + STANDARD_F16_S = "Standard_F16s" + STANDARD_G1 = "Standard_G1" + STANDARD_G2 = "Standard_G2" + STANDARD_G3 = "Standard_G3" + STANDARD_G4 = "Standard_G4" + STANDARD_G5 = "Standard_G5" + STANDARD_GS1 = "Standard_GS1" + STANDARD_GS2 = "Standard_GS2" + STANDARD_GS3 = "Standard_GS3" + STANDARD_GS4 = "Standard_GS4" + STANDARD_GS5 = "Standard_GS5" + STANDARD_H8 = "Standard_H8" + STANDARD_H16 = "Standard_H16" + STANDARD_H8_M = "Standard_H8m" + STANDARD_H16_M = "Standard_H16m" + STANDARD_H16_R = "Standard_H16r" + STANDARD_H16_MR = "Standard_H16mr" + STANDARD_L4_S = "Standard_L4s" + STANDARD_L8_S = "Standard_L8s" + STANDARD_L16_S = "Standard_L16s" + STANDARD_L32_S = "Standard_L32s" + STANDARD_D2_SV3 = "Standard_D2s_v3" + STANDARD_D4_SV3 = "Standard_D4s_v3" + STANDARD_D8_SV3 = "Standard_D8s_v3" + STANDARD_D16_SV3 = "Standard_D16s_v3" + STANDARD_D32_SV3 = "Standard_D32s_v3" + STANDARD_D64_SV3 = "Standard_D64s_v3" + STANDARD_D2_V3 = "Standard_D2_v3" + STANDARD_D4_V3 = "Standard_D4_v3" + STANDARD_D8_V3 = "Standard_D8_v3" + STANDARD_D16_V3 = "Standard_D16_v3" + STANDARD_D32_V3 = "Standard_D32_v3" + STANDARD_D64_V3 = "Standard_D64_v3" + STANDARD_F2_SV2 = "Standard_F2s_v2" + STANDARD_F4_SV2 = "Standard_F4s_v2" + STANDARD_F8_SV2 = "Standard_F8s_v2" + STANDARD_F16_SV2 = "Standard_F16s_v2" + STANDARD_F32_SV2 = "Standard_F32s_v2" + STANDARD_F64_SV2 = "Standard_F64s_v2" + STANDARD_F72_SV2 = "Standard_F72s_v2" + STANDARD_E2_V3 = "Standard_E2_v3" + STANDARD_E4_V3 = "Standard_E4_v3" + STANDARD_E8_V3 = "Standard_E8_v3" + STANDARD_E16_V3 = "Standard_E16_v3" + STANDARD_E32_V3 = "Standard_E32_v3" + STANDARD_E64_V3 = "Standard_E64_v3" + STANDARD_E2_SV3 = "Standard_E2s_v3" + STANDARD_E4_SV3 = "Standard_E4s_v3" + STANDARD_E8_SV3 = "Standard_E8s_v3" + STANDARD_E16_SV3 = "Standard_E16s_v3" + STANDARD_E32_SV3 = "Standard_E32s_v3" + STANDARD_E64_SV3 = "Standard_E64s_v3" + STANDARD_M64_S = "Standard_M64s" + STANDARD_M64_MS = "Standard_M64ms" + STANDARD_M128_S = "Standard_M128s" + STANDARD_M128_MS = "Standard_M128ms" + STANDARD_DC2_S = "Standard_DC2s" + STANDARD_DC4_S = "Standard_DC4s" + STANDARD_E20_V3 = "Standard_E20_v3" + STANDARD_E20_SV3 = "Standard_E20s_v3" + STANDARD_E64_IV3 = "Standard_E64i_v3" + STANDARD_E64_IS_V3 = "Standard_E64is_v3" + STANDARD_M8_MS = "Standard_M8ms" + STANDARD_M16_MS = "Standard_M16ms" + STANDARD_M32_LS = "Standard_M32ls" + STANDARD_M32_MS = "Standard_M32ms" + STANDARD_M32_TS = "Standard_M32ts" + STANDARD_M64 = "Standard_M64" + STANDARD_M64_LS = "Standard_M64ls" + STANDARD_M64_M = "Standard_M64m" + STANDARD_M128 = "Standard_M128" + STANDARD_M128_M = "Standard_M128m" + STANDARD_L8_SV2 = "Standard_L8s_v2" + STANDARD_L16_SV2 = "Standard_L16s_v2" + STANDARD_L32_SV2 = "Standard_L32s_v2" + STANDARD_L48_SV2 = "Standard_L48s_v2" + STANDARD_L64_SV2 = "Standard_L64s_v2" + STANDARD_L80_SV2 = "Standard_L80s_v2" + STANDARD_D2_V4 = "Standard_D2_v4" + STANDARD_D4_V4 = "Standard_D4_v4" + STANDARD_D8_V4 = "Standard_D8_v4" + STANDARD_D16_V4 = "Standard_D16_v4" + STANDARD_D32_V4 = "Standard_D32_v4" + STANDARD_D48_V4 = "Standard_D48_v4" + STANDARD_D64_V4 = "Standard_D64_v4" + STANDARD_D2_SV4 = "Standard_D2s_v4" + STANDARD_D4_SV4 = "Standard_D4s_v4" + STANDARD_D8_SV4 = "Standard_D8s_v4" + STANDARD_D16_SV4 = "Standard_D16s_v4" + STANDARD_D32_SV4 = "Standard_D32s_v4" + STANDARD_D48_SV4 = "Standard_D48s_v4" + STANDARD_D64_SV4 = "Standard_D64s_v4" + STANDARD_D2_DV4 = "Standard_D2d_v4" + STANDARD_D4_DV4 = "Standard_D4d_v4" + STANDARD_D8_DV4 = "Standard_D8d_v4" + STANDARD_D16_DV4 = "Standard_D16d_v4" + STANDARD_D32_DV4 = "Standard_D32d_v4" + STANDARD_D48_DV4 = "Standard_D48d_v4" + STANDARD_D64_DV4 = "Standard_D64d_v4" + STANDARD_D2_DS_V4 = "Standard_D2ds_v4" + STANDARD_D4_DS_V4 = "Standard_D4ds_v4" + STANDARD_D8_DS_V4 = "Standard_D8ds_v4" + STANDARD_D16_DS_V4 = "Standard_D16ds_v4" + STANDARD_D32_DS_V4 = "Standard_D32ds_v4" + STANDARD_D48_DS_V4 = "Standard_D48ds_v4" + STANDARD_D64_DS_V4 = "Standard_D64ds_v4" + STANDARD_E2_V4 = "Standard_E2_v4" + STANDARD_E4_V4 = "Standard_E4_v4" + STANDARD_E8_V4 = "Standard_E8_v4" + STANDARD_E16_V4 = "Standard_E16_v4" + STANDARD_E20_V4 = "Standard_E20_v4" + STANDARD_E32_V4 = "Standard_E32_v4" + STANDARD_E48_V4 = "Standard_E48_v4" + STANDARD_E64_V4 = "Standard_E64_v4" + STANDARD_E2_SV4 = "Standard_E2s_v4" + STANDARD_E4_SV4 = "Standard_E4s_v4" + STANDARD_E8_SV4 = "Standard_E8s_v4" + STANDARD_E16_SV4 = "Standard_E16s_v4" + STANDARD_E20_SV4 = "Standard_E20s_v4" + STANDARD_E32_SV4 = "Standard_E32s_v4" + STANDARD_E48_SV4 = "Standard_E48s_v4" + STANDARD_E64_SV4 = "Standard_E64s_v4" + STANDARD_E2_DV4 = "Standard_E2d_v4" + STANDARD_E4_DV4 = "Standard_E4d_v4" + STANDARD_E8_DV4 = "Standard_E8d_v4" + STANDARD_E16_DV4 = "Standard_E16d_v4" + STANDARD_E20_DV4 = "Standard_E20d_v4" + STANDARD_E32_DV4 = "Standard_E32d_v4" + STANDARD_E48_DV4 = "Standard_E48d_v4" + STANDARD_E64_DV4 = "Standard_E64d_v4" + STANDARD_E2_DS_V4 = "Standard_E2ds_v4" + STANDARD_E4_DS_V4 = "Standard_E4ds_v4" + STANDARD_E8_DS_V4 = "Standard_E8ds_v4" + STANDARD_E16_DS_V4 = "Standard_E16ds_v4" + STANDARD_E20_DS_V4 = "Standard_E20ds_v4" + STANDARD_E32_DS_V4 = "Standard_E32ds_v4" + STANDARD_E48_DS_V4 = "Standard_E48ds_v4" + STANDARD_E64_DS_V4 = "Standard_E64ds_v4" + STANDARD_E2_AS_V4 = "Standard_E2as_v4" + STANDARD_E4_AS_V4 = "Standard_E4as_v4" + STANDARD_E8_AS_V4 = "Standard_E8as_v4" + STANDARD_E16_AS_V4 = "Standard_E16as_v4" + STANDARD_E20_AS_V4 = "Standard_E20as_v4" + STANDARD_E32_AS_V4 = "Standard_E32as_v4" + STANDARD_E48_AS_V4 = "Standard_E48as_v4" + STANDARD_E64_AS_V4 = "Standard_E64as_v4" + STANDARD_E96_AS_V4 = "Standard_E96as_v4" + STANDARD_D2_AS_V4 = "Standard_D2as_v4" + STANDARD_D4_AS_V4 = "Standard_D4as_v4" + STANDARD_D8_AS_V4 = "Standard_D8as_v4" + STANDARD_D16_AS_V4 = "Standard_D16as_v4" + STANDARD_D32_AS_V4 = "Standard_D32as_v4" + STANDARD_D48_AS_V4 = "Standard_D48as_v4" + STANDARD_D64_AS_V4 = "Standard_D64as_v4" + STANDARD_D96_AS_V4 = "Standard_D96as_v4" + STANDARD_M208_MS_V2 = "Standard_M208ms_v2" + STANDARD_M208_SV2 = "Standard_M208s_v2" + STANDARD_M416_MS_V2 = "Standard_M416ms_v2" + STANDARD_M416_SV2 = "Standard_M416s_v2" + STANDARD_F48_SV2 = "Standard_F48s_v2" + STANDARD_E48_V3 = "Standard_E48_v3" + STANDARD_E48_SV3 = "Standard_E48s_v3" + STANDARD_E80_IS_V4 = "Standard_E80is_v4" + STANDARD_E80_IDS_V4 = "Standard_E80ids_v4" + STANDARD_E2_AV4 = "Standard_E2a_v4" + STANDARD_E4_AV4 = "Standard_E4a_v4" + STANDARD_E8_AV4 = "Standard_E8a_v4" + STANDARD_E16_AV4 = "Standard_E16a_v4" + STANDARD_E20_AV4 = "Standard_E20a_v4" + STANDARD_E32_AV4 = "Standard_E32a_v4" + STANDARD_E48_AV4 = "Standard_E48a_v4" + STANDARD_E64_AV4 = "Standard_E64a_v4" + STANDARD_E96_AV4 = "Standard_E96a_v4" + STANDARD_D2_AV4 = "Standard_D2a_v4" + STANDARD_D4_AV4 = "Standard_D4a_v4" + STANDARD_D8_AV4 = "Standard_D8a_v4" + STANDARD_D16_AV4 = "Standard_D16a_v4" + STANDARD_D32_AV4 = "Standard_D32a_v4" + STANDARD_D48_AV4 = "Standard_D48a_v4" + STANDARD_D64_AV4 = "Standard_D64a_v4" + STANDARD_D96_AV4 = "Standard_D96a_v4" + STANDARD_M32_MS_V2 = "Standard_M32ms_v2" + STANDARD_M64_SV2 = "Standard_M64s_v2" + STANDARD_M64_MS_V2 = "Standard_M64ms_v2" + STANDARD_M128_SV2 = "Standard_M128s_v2" + STANDARD_M128_MS_V2 = "Standard_M128ms_v2" + STANDARD_M192_IS_V2 = "Standard_M192is_v2" + STANDARD_M192_IMS_V2 = "Standard_M192ims_v2" + STANDARD_M32_DMS_V2 = "Standard_M32dms_v2" + STANDARD_M64_DS_V2 = "Standard_M64ds_v2" + STANDARD_M64_DMS_V2 = "Standard_M64dms_v2" + STANDARD_M128_DS_V2 = "Standard_M128ds_v2" + STANDARD_M128_DMS_V2 = "Standard_M128dms_v2" + STANDARD_M192_IDS_V2 = "Standard_M192ids_v2" + STANDARD_M192_IDMS_V2 = "Standard_M192idms_v2" + STANDARD_D2_V5 = "Standard_D2_v5" + STANDARD_D4_V5 = "Standard_D4_v5" + STANDARD_D8_V5 = "Standard_D8_v5" + STANDARD_D16_V5 = "Standard_D16_v5" + STANDARD_D32_V5 = "Standard_D32_v5" + STANDARD_D48_V5 = "Standard_D48_v5" + STANDARD_D64_V5 = "Standard_D64_v5" + STANDARD_D96_V5 = "Standard_D96_v5" + STANDARD_D2_SV5 = "Standard_D2s_v5" + STANDARD_D4_SV5 = "Standard_D4s_v5" + STANDARD_D8_SV5 = "Standard_D8s_v5" + STANDARD_D16_SV5 = "Standard_D16s_v5" + STANDARD_D32_SV5 = "Standard_D32s_v5" + STANDARD_D48_SV5 = "Standard_D48s_v5" + STANDARD_D64_SV5 = "Standard_D64s_v5" + STANDARD_D96_SV5 = "Standard_D96s_v5" + STANDARD_D2_DV5 = "Standard_D2d_v5" + STANDARD_D4_DV5 = "Standard_D4d_v5" + STANDARD_D8_DV5 = "Standard_D8d_v5" + STANDARD_D16_DV5 = "Standard_D16d_v5" + STANDARD_D32_DV5 = "Standard_D32d_v5" + STANDARD_D48_DV5 = "Standard_D48d_v5" + STANDARD_D64_DV5 = "Standard_D64d_v5" + STANDARD_D96_DV5 = "Standard_D96d_v5" + STANDARD_D2_DS_V5 = "Standard_D2ds_v5" + STANDARD_D4_DS_V5 = "Standard_D4ds_v5" + STANDARD_D8_DS_V5 = "Standard_D8ds_v5" + STANDARD_D16_DS_V5 = "Standard_D16ds_v5" + STANDARD_D32_DS_V5 = "Standard_D32ds_v5" + STANDARD_D48_DS_V5 = "Standard_D48ds_v5" + STANDARD_D64_DS_V5 = "Standard_D64ds_v5" + STANDARD_D96_DS_V5 = "Standard_D96ds_v5" + STANDARD_D2_AS_V5 = "Standard_D2as_v5" + STANDARD_D4_AS_V5 = "Standard_D4as_v5" + STANDARD_D8_AS_V5 = "Standard_D8as_v5" + STANDARD_D16_AS_V5 = "Standard_D16as_v5" + STANDARD_D32_AS_V5 = "Standard_D32as_v5" + STANDARD_D48_AS_V5 = "Standard_D48as_v5" + STANDARD_D64_AS_V5 = "Standard_D64as_v5" + STANDARD_D96_AS_V5 = "Standard_D96as_v5" + STANDARD_D2_ADS_V5 = "Standard_D2ads_v5" + STANDARD_D4_ADS_V5 = "Standard_D4ads_v5" + STANDARD_D8_ADS_V5 = "Standard_D8ads_v5" + STANDARD_D16_ADS_V5 = "Standard_D16ads_v5" + STANDARD_D32_ADS_V5 = "Standard_D32ads_v5" + STANDARD_D48_ADS_V5 = "Standard_D48ads_v5" + STANDARD_D64_ADS_V5 = "Standard_D64ads_v5" + STANDARD_D96_ADS_V5 = "Standard_D96ads_v5" + STANDARD_E2_V5 = "Standard_E2_v5" + STANDARD_E4_V5 = "Standard_E4_v5" + STANDARD_E8_V5 = "Standard_E8_v5" + STANDARD_E16_V5 = "Standard_E16_v5" + STANDARD_E20_V5 = "Standard_E20_v5" + STANDARD_E32_V5 = "Standard_E32_v5" + STANDARD_E48_V5 = "Standard_E48_v5" + STANDARD_E64_V5 = "Standard_E64_v5" + STANDARD_E96_V5 = "Standard_E96_v5" + STANDARD_E104_IV5 = "Standard_E104i_v5" + STANDARD_E2_SV5 = "Standard_E2s_v5" + STANDARD_E4_SV5 = "Standard_E4s_v5" + STANDARD_E8_SV5 = "Standard_E8s_v5" + STANDARD_E16_SV5 = "Standard_E16s_v5" + STANDARD_E20_SV5 = "Standard_E20s_v5" + STANDARD_E32_SV5 = "Standard_E32s_v5" + STANDARD_E48_SV5 = "Standard_E48s_v5" + STANDARD_E64_SV5 = "Standard_E64s_v5" + STANDARD_E96_SV5 = "Standard_E96s_v5" + STANDARD_E104_IS_V5 = "Standard_E104is_v5" + STANDARD_E2_DV5 = "Standard_E2d_v5" + STANDARD_E4_DV5 = "Standard_E4d_v5" + STANDARD_E8_DV5 = "Standard_E8d_v5" + STANDARD_E16_DV5 = "Standard_E16d_v5" + STANDARD_E20_DV5 = "Standard_E20d_v5" + STANDARD_E32_DV5 = "Standard_E32d_v5" + STANDARD_E48_DV5 = "Standard_E48d_v5" + STANDARD_E64_DV5 = "Standard_E64d_v5" + STANDARD_E96_DV5 = "Standard_E96d_v5" + STANDARD_E104_ID_V5 = "Standard_E104id_v5" + STANDARD_E2_DS_V5 = "Standard_E2ds_v5" + STANDARD_E4_DS_V5 = "Standard_E4ds_v5" + STANDARD_E8_DS_V5 = "Standard_E8ds_v5" + STANDARD_E16_DS_V5 = "Standard_E16ds_v5" + STANDARD_E20_DS_V5 = "Standard_E20ds_v5" + STANDARD_E32_DS_V5 = "Standard_E32ds_v5" + STANDARD_E48_DS_V5 = "Standard_E48ds_v5" + STANDARD_E64_DS_V5 = "Standard_E64ds_v5" + STANDARD_E96_DS_V5 = "Standard_E96ds_v5" + STANDARD_E104_IDS_V5 = "Standard_E104ids_v5" + STANDARD_E2_AS_V5 = "Standard_E2as_v5" + STANDARD_E4_AS_V5 = "Standard_E4as_v5" + STANDARD_E8_AS_V5 = "Standard_E8as_v5" + STANDARD_E16_AS_V5 = "Standard_E16as_v5" + STANDARD_E20_AS_V5 = "Standard_E20as_v5" + STANDARD_E32_AS_V5 = "Standard_E32as_v5" + STANDARD_E48_AS_V5 = "Standard_E48as_v5" + STANDARD_E64_AS_V5 = "Standard_E64as_v5" + STANDARD_E96_AS_V5 = "Standard_E96as_v5" + STANDARD_E2_ADS_V5 = "Standard_E2ads_v5" + STANDARD_E4_ADS_V5 = "Standard_E4ads_v5" + STANDARD_E8_ADS_V5 = "Standard_E8ads_v5" + STANDARD_E16_ADS_V5 = "Standard_E16ads_v5" + STANDARD_E20_ADS_V5 = "Standard_E20ads_v5" + STANDARD_E32_ADS_V5 = "Standard_E32ads_v5" + STANDARD_E48_ADS_V5 = "Standard_E48ads_v5" + STANDARD_E64_ADS_V5 = "Standard_E64ads_v5" + STANDARD_E96_ADS_V5 = "Standard_E96ads_v5" + STANDARD_M82_MS = "Standard_M8_2ms" + STANDARD_M84_MS = "Standard_M8_4ms" + STANDARD_M164_MS = "Standard_M16_4ms" + STANDARD_M168_MS = "Standard_M16_8ms" + STANDARD_M328_MS = "Standard_M32_8ms" + STANDARD_M3216_MS = "Standard_M32_16ms" + STANDARD_M6432_MS = "Standard_M64_32ms" + STANDARD_M6416_MS = "Standard_M64_16ms" + STANDARD_M12864_MS = "Standard_M128_64ms" + STANDARD_M12832_MS = "Standard_M128_32ms" + STANDARD_E42_SV3 = "Standard_E4_2s_v3" + STANDARD_E84_SV3 = "Standard_E8_4s_v3" + STANDARD_E82_SV3 = "Standard_E8_2s_v3" + STANDARD_E168_SV3 = "Standard_E16_8s_v3" + STANDARD_E164_SV3 = "Standard_E16_4s_v3" + STANDARD_E3216_SV3 = "Standard_E32_16s_v3" + STANDARD_E328_SV3 = "Standard_E32_8s_v3" + STANDARD_E6432_SV3 = "Standard_E64_32s_v3" + STANDARD_E6416_SV3 = "Standard_E64_16s_v3" + STANDARD_E42_SV4 = "Standard_E4_2s_v4" + STANDARD_E84_SV4 = "Standard_E8_4s_v4" + STANDARD_E82_SV4 = "Standard_E8_2s_v4" + STANDARD_E168_SV4 = "Standard_E16_8s_v4" + STANDARD_E164_SV4 = "Standard_E16_4s_v4" + STANDARD_E3216_SV4 = "Standard_E32_16s_v4" + STANDARD_E328_SV4 = "Standard_E32_8s_v4" + STANDARD_E6432_SV4 = "Standard_E64_32s_v4" + STANDARD_E6416_SV4 = "Standard_E64_16s_v4" + STANDARD_E42_DS_V4 = "Standard_E4_2ds_v4" + STANDARD_E84_DS_V4 = "Standard_E8_4ds_v4" + STANDARD_E82_DS_V4 = "Standard_E8_2ds_v4" + STANDARD_E168_DS_V4 = "Standard_E16_8ds_v4" + STANDARD_E164_DS_V4 = "Standard_E16_4ds_v4" + STANDARD_E3216_DS_V4 = "Standard_E32_16ds_v4" + STANDARD_E328_DS_V4 = "Standard_E32_8ds_v4" + STANDARD_E6432_DS_V4 = "Standard_E64_32ds_v4" + STANDARD_E6416_DS_V4 = "Standard_E64_16ds_v4" + STANDARD_E42_AS_V4 = "Standard_E4_2as_v4" + STANDARD_E84_AS_V4 = "Standard_E8_4as_v4" + STANDARD_E82_AS_V4 = "Standard_E8_2as_v4" + STANDARD_E168_AS_V4 = "Standard_E16_8as_v4" + STANDARD_E164_AS_V4 = "Standard_E16_4as_v4" + STANDARD_E3216_AS_V4 = "Standard_E32_16as_v4" + STANDARD_E328_AS_V4 = "Standard_E32_8as_v4" + STANDARD_E6432_AS_V4 = "Standard_E64_32as_v4" + STANDARD_E6416_AS_V4 = "Standard_E64_16as_v4" + STANDARD_E9648_AS_V4 = "Standard_E96_48as_v4" + STANDARD_E9624_AS_V4 = "Standard_E96_24as_v4" + STANDARD_E42_ADS_V5 = "Standard_E4_2ads_v5" + STANDARD_E84_ADS_V5 = "Standard_E8_4ads_v5" + STANDARD_E82_ADS_V5 = "Standard_E8_2ads_v5" + STANDARD_E168_ADS_V5 = "Standard_E16_8ads_v5" + STANDARD_E164_ADS_V5 = "Standard_E16_4ads_v5" + STANDARD_E3216_ADS_V5 = "Standard_E32_16ads_v5" + STANDARD_E328_ADS_V5 = "Standard_E32_8ads_v5" + STANDARD_E6432_ADS_V5 = "Standard_E64_32ads_v5" + STANDARD_E6416_ADS_V5 = "Standard_E64_16ads_v5" + STANDARD_E9648_ADS_V5 = "Standard_E96_48ads_v5" + STANDARD_E9624_ADS_V5 = "Standard_E96_24ads_v5" + STANDARD_E42_SV5 = "Standard_E4_2s_v5" + STANDARD_E84_SV5 = "Standard_E8_4s_v5" + STANDARD_E82_SV5 = "Standard_E8_2s_v5" + STANDARD_E168_SV5 = "Standard_E16_8s_v5" + STANDARD_E164_SV5 = "Standard_E16_4s_v5" + STANDARD_E3216_SV5 = "Standard_E32_16s_v5" + STANDARD_E328_SV5 = "Standard_E32_8s_v5" + STANDARD_E6432_SV5 = "Standard_E64_32s_v5" + STANDARD_E6416_SV5 = "Standard_E64_16s_v5" + STANDARD_E9648_SV5 = "Standard_E96_48s_v5" + STANDARD_E9624_SV5 = "Standard_E96_24s_v5" + STANDARD_E42_DS_V5 = "Standard_E4_2ds_v5" + STANDARD_E84_DS_V5 = "Standard_E8_4ds_v5" + STANDARD_E82_DS_V5 = "Standard_E8_2ds_v5" + STANDARD_E168_DS_V5 = "Standard_E16_8ds_v5" + STANDARD_E164_DS_V5 = "Standard_E16_4ds_v5" + STANDARD_E3216_DS_V5 = "Standard_E32_16ds_v5" + STANDARD_E328_DS_V5 = "Standard_E32_8ds_v5" + STANDARD_E6432_DS_V5 = "Standard_E64_32ds_v5" + STANDARD_E6416_DS_V5 = "Standard_E64_16ds_v5" + STANDARD_E9648_DS_V5 = "Standard_E96_48ds_v5" + STANDARD_E9624_DS_V5 = "Standard_E96_24ds_v5" + STANDARD_E42_AS_V5 = "Standard_E4_2as_v5" + STANDARD_E84_AS_V5 = "Standard_E8_4as_v5" + STANDARD_E82_AS_V5 = "Standard_E8_2as_v5" + STANDARD_E168_AS_V5 = "Standard_E16_8as_v5" + STANDARD_E164_AS_V5 = "Standard_E16_4as_v5" + STANDARD_E3216_AS_V5 = "Standard_E32_16as_v5" + STANDARD_E328_AS_V5 = "Standard_E32_8as_v5" + STANDARD_E6432_AS_V5 = "Standard_E64_32as_v5" + STANDARD_E6416_AS_V5 = "Standard_E64_16as_v5" + STANDARD_E9648_AS_V5 = "Standard_E96_48as_v5" + STANDARD_E9624_AS_V5 = "Standard_E96_24as_v5" + STANDARD_GS48 = "Standard_GS4_8" + STANDARD_GS44 = "Standard_GS4_4" + STANDARD_GS516 = "Standard_GS5_16" + STANDARD_GS58 = "Standard_GS5_8" + STANDARD_DS111_V2 = "Standard_DS11_1_v2" + STANDARD_DS122_V2 = "Standard_DS12_2_v2" + STANDARD_DS121_V2 = "Standard_DS12_1_v2" + STANDARD_DS134_V2 = "Standard_DS13_4_v2" + STANDARD_DS132_V2 = "Standard_DS13_2_v2" + STANDARD_DS148_V2 = "Standard_DS14_8_v2" + STANDARD_DS144_V2 = "Standard_DS14_4_v2" + STANDARD_M416208_SV2 = "Standard_M416_208s_v2" + STANDARD_M416208_MS_V2 = "Standard_M416_208ms_v2" + STANDARD_E2_BS_V5 = "Standard_E2bs_v5" + STANDARD_E4_BS_V5 = "Standard_E4bs_v5" + STANDARD_E8_BS_V5 = "Standard_E8bs_v5" + STANDARD_E16_BS_V5 = "Standard_E16bs_v5" + STANDARD_E32_BS_V5 = "Standard_E32bs_v5" + STANDARD_E48_BS_V5 = "Standard_E48bs_v5" + STANDARD_E64_BS_V5 = "Standard_E64bs_v5" + STANDARD_E2_BDS_V5 = "Standard_E2bds_v5" + STANDARD_E4_BDS_V5 = "Standard_E4bds_v5" + STANDARD_E8_BDS_V5 = "Standard_E8bds_v5" + STANDARD_E16_BDS_V5 = "Standard_E16bds_v5" + STANDARD_E32_BDS_V5 = "Standard_E32bds_v5" + STANDARD_E48_BDS_V5 = "Standard_E48bds_v5" + STANDARD_E64_BDS_V5 = "Standard_E64bds_v5" + + +class AzureVmSuitabilityDetail(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureVmSuitabilityDetail.""" + + NONE = "None" + RECOMMENDED_SIZE_HAS_LESS_NETWORK_ADAPTERS = "RecommendedSizeHasLessNetworkAdapters" + CANNOT_REPORT_COMPUTE_COST = "CannotReportComputeCost" + CANNOT_REPORT_STORAGE_COST = "CannotReportStorageCost" + CANNOT_REPORT_BANDWIDTH_COSTS = "CannotReportBandwidthCosts" + PERCENTAGE_OF_CORES_UTILIZED_MISSING = "PercentageOfCoresUtilizedMissing" + PERCENTAGE_OF_MEMORY_UTILIZED_MISSING = "PercentageOfMemoryUtilizedMissing" + PERCENTAGE_OF_CORES_UTILIZED_OUT_OF_RANGE = "PercentageOfCoresUtilizedOutOfRange" + PERCENTAGE_OF_MEMORY_UTILIZED_OUT_OF_RANGE = "PercentageOfMemoryUtilizedOutOfRange" + + +class AzureVmSuitabilityExplanation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureVmSuitabilityExplanation.""" + + UNKNOWN = "Unknown" + NOT_APPLICABLE = "NotApplicable" + GUEST_OPERATING_SYSTEM_ARCHITECTURE_NOT_SUPPORTED = "GuestOperatingSystemArchitectureNotSupported" + GUEST_OPERATING_SYSTEM_NOT_SUPPORTED = "GuestOperatingSystemNotSupported" + BOOT_TYPE_NOT_SUPPORTED = "BootTypeNotSupported" + MORE_DISKS_THAN_SUPPORTED = "MoreDisksThanSupported" + NO_SUITABLE_VM_SIZE_FOUND = "NoSuitableVmSizeFound" + ONE_OR_MORE_DISKS_NOT_SUITABLE = "OneOrMoreDisksNotSuitable" + ONE_OR_MORE_ADAPTERS_NOT_SUITABLE = "OneOrMoreAdaptersNotSuitable" + INTERNAL_ERROR_OCCURRED_DURING_COMPUTE_EVALUATION = "InternalErrorOccurredDuringComputeEvaluation" + INTERNAL_ERROR_OCCURRED_DURING_STORAGE_EVALUATION = "InternalErrorOccurredDuringStorageEvaluation" + INTERNAL_ERROR_OCCURRED_DURING_NETWORK_EVALUATION = "InternalErrorOccurredDuringNetworkEvaluation" + NO_VM_SIZE_SUPPORTS_STORAGE_PERFORMANCE = "NoVmSizeSupportsStoragePerformance" + NO_VM_SIZE_SUPPORTS_NETWORK_PERFORMANCE = "NoVmSizeSupportsNetworkPerformance" + NO_VM_SIZE_FOR_SELECTED_PRICING_TIER = "NoVmSizeForSelectedPricingTier" + NO_VM_SIZE_FOR_SELECTED_AZURE_LOCATION = "NoVmSizeForSelectedAzureLocation" + CHECK_RED_HAT_LINUX_VERSION = "CheckRedHatLinuxVersion" + CHECK_OPEN_SUSE_LINUX_VERSION = "CheckOpenSuseLinuxVersion" + CHECK_WINDOWS_SERVER2008_R2_VERSION = "CheckWindowsServer2008R2Version" + CHECK_CENT_OS_VERSION = "CheckCentOsVersion" + CHECK_DEBIAN_LINUX_VERSION = "CheckDebianLinuxVersion" + CHECK_SUSE_LINUX_VERSION = "CheckSuseLinuxVersion" + CHECK_ORACLE_LINUX_VERSION = "CheckOracleLinuxVersion" + CHECK_UBUNTU_LINUX_VERSION = "CheckUbuntuLinuxVersion" + CHECK_CORE_OS_LINUX_VERSION = "CheckCoreOsLinuxVersion" + WINDOWS_SERVER_VERSION_CONDITIONALLY_SUPPORTED = "WindowsServerVersionConditionallySupported" + NO_GUEST_OPERATING_SYSTEM_CONDITIONALLY_SUPPORTED = "NoGuestOperatingSystemConditionallySupported" + WINDOWS_CLIENT_VERSIONS_CONDITIONALLY_SUPPORTED = "WindowsClientVersionsConditionallySupported" + BOOT_TYPE_UNKNOWN = "BootTypeUnknown" + GUEST_OPERATING_SYSTEM_UNKNOWN = "GuestOperatingSystemUnknown" + WINDOWS_SERVER_VERSIONS_SUPPORTED_WITH_CAVEAT = "WindowsServerVersionsSupportedWithCaveat" + WINDOWS_OS_NO_LONGER_UNDER_MS_SUPPORT = "WindowsOSNoLongerUnderMSSupport" + ENDORSED_WITH_CONDITIONS_LINUX_DISTRIBUTIONS = "EndorsedWithConditionsLinuxDistributions" + UNENDORSED_LINUX_DISTRIBUTIONS = "UnendorsedLinuxDistributions" + NO_VM_SIZE_FOR_STANDARD_PRICING_TIER = "NoVmSizeForStandardPricingTier" + NO_VM_SIZE_FOR_BASIC_PRICING_TIER = "NoVmSizeForBasicPricingTier" + NO_VM_SIZE_IN_SELECTED_FAMILY_FOUND = "NoVmSizeInSelectedFamilyFound" + NO_EA_PRICE_FOUND_FOR_VM_SIZE = "NoEaPriceFoundForVmSize" + NO_VM_SIZE_FOUND_FOR_OFFER_CURRENCY_RESERVED_INSTANCE = "NoVmSizeFoundForOfferCurrencyReservedInstance" + + +class AzureWebAppSuitabilityIssueCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureWebAppSuitabilityIssueCategory.""" + + UNKNOWN = "Unknown" + ISSUE = "Issue" + INFO = "Info" + + +class AzureWebAppTargetType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureWebAppTargetType.""" + + UNKNOWN = "Unknown" + AZURE_APP_SERVICE = "AzureAppService" + AZURE_APP_SERVICE_CONTAINER = "AzureAppServiceContainer" + + +class AzureWebAppTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AzureWebAppTier.""" + + UNKNOWN = "Unknown" + FREE = "Free" + PREMIUM_V2 = "Premium_V2" + PREMIUM_V3 = "Premium_V3" + ISOLATED = "Isolated" + + +class BusinessCaseCurrency(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Business case supported currency types.""" + + UNKNOWN = "Unknown" + """Currency Unknown.""" + USD = "USD" + """Currency USD.""" + DKK = "DKK" + """Currency DKK.""" + CAD = "CAD" + """Currency CAD.""" + IDR = "IDR" + """Currency IDR.""" + JPY = "JPY" + """Currency JPY.""" + KRW = "KRW" + """Currency KRW.""" + NZD = "NZD" + """Currency NZD.""" + NOK = "NOK" + """Currency NOK.""" + RUB = "RUB" + """Currency RUB.""" + SAR = "SAR" + """Currency SAR.""" + ZAR = "ZAR" + """Currency ZAR.""" + SEK = "SEK" + """Currency SEK.""" + TRY = "TRY" + """Currency TRY.""" + GBP = "GBP" + """Currency GBP.""" + MXN = "MXN" + """Currency MXN.""" + MYR = "MYR" + """Currency MYR.""" + INR = "INR" + """Currency INR.""" + HKD = "HKD" + """Currency HKD.""" + BRL = "BRL" + """Currency BRL.""" + TWD = "TWD" + """Currency TWD.""" + EUR = "EUR" + """Currency EUR.""" + CHF = "CHF" + """Currency CHF.""" + ARS = "ARS" + """Currency ARS.""" + AUD = "AUD" + """Currency AUD.""" + CNY = "CNY" + """Currency CNY.""" + TRY_ENUM = "TRY" + """Currency TRY.""" + + +class BusinessCaseState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Business case supported state types.""" + + UNKNOWN = "Unknown" + """Unknown State.""" + IN_PROGRESS = "InProgress" + """InProgress State.""" + COMPLETED = "Completed" + """Completed State.""" + OUT_DATED = "OutDated" + """OutDated State.""" + INVALID = "Invalid" + """Invalid State.""" + OUT_OF_SYNC = "OutOfSync" + """OutOfSync State.""" + FAILED = "Failed" + """Failed State.""" + + +class CheckResult(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Suitability Check or Rule Result.""" + + UNKNOWN = "Unknown" + """Indicates missing value.""" + ISSUE = "Issue" + """Indicates Migration Issue.""" + WARN = "Warn" + """Indicates Migration Warning.""" + PASS = "Pass" + """Indicates check is passed.""" + PASS_ENUM = "Pass" + """Indicates check is passed.""" + + +class CloudSuitability(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Cloud Suitability for Azure.""" + + UNKNOWN = "Unknown" + """Unknown. Indicates missing data.""" + NOT_SUITABLE = "NotSuitable" + """Not Suitable for Azure.""" + SUITABLE = "Suitable" + """Suitable for Azure.""" + CONDITIONALLY_SUITABLE = "ConditionallySuitable" + """Conditionally Suitable for Azure.""" + READINESS_UNKNOWN = "ReadinessUnknown" + """Unknown Readiness for Azure.""" + + +class CompatibilityLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CompatibilityLevel.""" + + UNKNOWN = "Unknown" + COMPAT_LEVEL80 = "CompatLevel80" + COMPAT_LEVEL90 = "CompatLevel90" + COMPAT_LEVEL100 = "CompatLevel100" + COMPAT_LEVEL110 = "CompatLevel110" + COMPAT_LEVEL120 = "CompatLevel120" + COMPAT_LEVEL130 = "CompatLevel130" + COMPAT_LEVEL140 = "CompatLevel140" + COMPAT_LEVEL150 = "CompatLevel150" + + +class ComputeTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ComputeTier.""" + + UNKNOWN = "Unknown" + AUTOMATIC = "Automatic" + PROVISIONED = "Provisioned" + SERVERLESS = "Serverless" + + +class ConsolidationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Consolidation Type.""" + + FULL = "Full" + """Full Consolidation.""" + AS_ON_SOURCE = "AsOnSource" + """As On Source or On Premises Consolidation.""" + + +class CostComponentName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum to represent component name.""" + + UNKNOWN = "Unknown" + """Default Cost Component name represented by Unknown.""" + MONTHLY_AZURE_HYBRID_COST_SAVINGS = "MonthlyAzureHybridCostSavings" + """Cost Savings due to Windows Azure Hybrid on monthly basis.""" + MONTHLY_SECURITY_COST = "MonthlySecurityCost" + """Monthly security cost.""" + MONTHLY_PREMIUM_V2_STORAGE_COST = "MonthlyPremiumV2StorageCost" + """Monthly PremiumV2 Storage Cost.""" + MONTHLY_LINUX_AZURE_HYBRID_COST_SAVINGS = "MonthlyLinuxAzureHybridCostSavings" + """Cost Savings due to Linux Azure Hybrid on monthly basis.""" + MONTHLY_AVS_NODE_COST = "MonthlyAvsNodeCost" + """Monthly AVS Node cost""" + MONTHLY_AVS_EXTERNAL_STORAGE_COST = "MonthlyAvsExternalStorageCost" + """Monthly AVS External Storage cost""" + MONTHLY_AVS_NETWORK_COST = "MonthlyAvsNetworkCost" + """Monthly AVS Network cost""" + MONTHLY_VCF_BYOL_COST_DIFFERENCE = "MonthlyVcfByolCostDifference" + """Monthly compute cost difference between VCF BYOL and non VCF BYOL SKUs""" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +class DiscoverySource(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Business case supported Discovery source types.""" + + UNKNOWN = "Unknown" + """Unknown Discovery Source.""" + APPLIANCE = "Appliance" + """Appliance Discovery Source.""" + IMPORT = "Import" + """Import Discovery Source.""" + IMPORT_ENUM = "Import" + """Import Discovery Source.""" + + +class EnvironmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """EnvironmentType.""" + + PRODUCTION = "Production" + TEST = "Test" + + +class ExternalStorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Different External storage skus.""" + + UNKNOWN = "Unknown" + """Indicates un-supported external storage.""" + NONE = "None" + """Indicates No external storage.""" + ANF_STANDARD = "AnfStandard" + """ANF external storage with Standard SKU.""" + ANF_PREMIUM = "AnfPremium" + """ANF external storage with Premium SKU.""" + ANF_ULTRA = "AnfUltra" + """ANF external storage with Ultra SKU.""" + + +class FttAndRaidLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """FTT and RAID Level.""" + + UNKNOWN = "Unknown" + """Unknown FTT and RAID Level.""" + FTT1_RAID1 = "Ftt1Raid1" + """FTT 1 and RAID Level 1.""" + FTT1_RAID5 = "Ftt1Raid5" + """FTT 1 and RAID Level 5.""" + FTT2_RAID1 = "Ftt2Raid1" + """FTT 2 and RAID Level 1.""" + FTT2_RAID6 = "Ftt2Raid6" + """FTT 2 and RAID Level 6.""" + FTT3_RAID1 = "Ftt3Raid1" + """FTT 3 and RAID Level 1.""" + + +class GroupStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """GroupStatus.""" + + CREATED = "Created" + UPDATED = "Updated" + RUNNING = "Running" + COMPLETED = "Completed" + INVALID = "Invalid" + + +class GroupType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """GroupType.""" + + DEFAULT = "Default" + IMPORT = "Import" + IMPORT_ENUM = "Import" + + +class GroupUpdateOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """GroupUpdateOperation.""" + + ADD = "Add" + REMOVE = "Remove" + + +class GuestOperatingSystemArchitecture(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """GuestOperatingSystemArchitecture.""" + + UNKNOWN = "Unknown" + X86 = "X86" + X64 = "X64" + + +class HardwareGeneration(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """HardwareGeneration.""" + + UNKNOWN = "Unknown" + AUTOMATIC = "Automatic" + GEN5 = "Gen5" + FSV2_SERIES = "Fsv2_series" + M_SERIES = "M_series" + DC_SERIES = "DC_series" + + +class HyperVLicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Business case supported HyperV License types.""" + + UNKNOWN = "Unknown" + """Unknown HyperV License.""" + DATACENTRE = "Datacentre" + """Datacentre HyperV License.""" + STANDARD = "Standard" + """Standard HyperV License.""" + + +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Business case supported VmWare License types.""" + + UNKNOWN = "Unknown" + """Unknown License.""" + V_SPHERE_STANDARD = "VSphereStandard" + """VSphereStandard License.""" + V_SPHERE_ENTERPRISE_PLUS = "VSphereEnterprisePlus" + """VSphereEnterprisePlus License.""" + + +class LicensingProgram(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Licensing Program for Azure.""" + + DEFAULT = "Default" + """Default value. Indicates Pay As You Go.""" + EA = "EA" + """Enterprise Agreement.""" + + +class MachineBootType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MachineBootType.""" + + UNKNOWN = "Unknown" + EFI = "EFI" + BIOS = "BIOS" + NOT_SPECIFIED = "NotSpecified" + + +class ManagementCostComponentName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Management Cost Component Names.""" + + UNKNOWN = "Unknown" + """Unknown Management Cost Component.""" + SYSTEM_CENTER_LICENSE_COST = "SystemCenterLicenseCost" + """System Center License Cost.""" + V_SPHERE_MANAGEMENT_COST = "VSphereManagementCost" + """VSphere eManagement Cost.""" + THIRD_PARTY_MANAGEMENT_COST = "ThirdPartyManagementCost" + """Third Party Management Cost.""" + OTHER_MONITORING_COST = "OtherMonitoringCost" + """Other Monitoring Cost.""" + OTHER_DATA_PROTECTION_COST = "OtherDataProtectionCost" + """Other Data Protection Cost.""" + OTHER_PATCHING_COST = "OtherPatchingCost" + """Other Patching Cost.""" + AZURE_MONITORING_COST = "AzureMonitoringCost" + """Azure Monitoring Cost.""" + AZURE_PATCHING_COST = "AzurePatchingCost" + """Azure Patching Cost.""" + AZURE_DATA_PROTECTION_COST = "AzureDataProtectionCost" + """Azure Data Protection Cost.""" + AZURE_ARC_MONITORING_COST = "AzureArcMonitoringCost" + """Azure Arc Monitoring Cost.""" + AZURE_ARC_PATCHING_COST = "AzureArcPatchingCost" + """Azure Arc Patching Cost.""" + + +class MigrationStrategy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Business case supported migration strategy types.""" + + UNKNOWN = "Unknown" + """Unknown Migration Strategy.""" + OPTIMIZE_FOR_COST = "OptimizeForCost" + """Optimize for cost.""" + IAA_S_ONLY = "IaaSOnly" + """IaaS only.""" + OPTIMIZE_FOR_PAAS = "OptimizeForPaas" + """Optimize for PaaS.""" + AVS_ONLY = "AVSOnly" + """Avs only.""" + + +class MultiSubnetIntent(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MultiSubnetIntent.""" + + NONE = "None" + HIGH_AVAILABILITY = "HighAvailability" + DISASTER_RECOVERY = "DisasterRecovery" + + +class NetworkSkuType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Different network skus.""" + + UNKNOWN = "Unknown" + """Indicates un-supported network SKU.""" + NONE = "None" + """Indicates No network SKU.""" + EXPRESS_ROUTE_ULTRA = "ExpressRouteUltra" + """Express Route network type with Ultra SKU.""" + + +class NodePoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Node Pool Mode.""" + + USER = "User" + """Indicates User node pool.""" + SYSTEM = "System" + """Indicates System node pool.""" + + +class OptimizationLogic(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """OptimizationLogic.""" + + MINIMIZE_COST = "MinimizeCost" + MODERNIZE_TO_PAA_S = "ModernizeToPaaS" + MODERNIZE_TO_AZURE_SQL_MI = "ModernizeToAzureSqlMi" + MODERNIZE_TO_AZURE_SQL_DB = "ModernizeToAzureSqlDb" + + +class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is "user,system". + """ + + USER = "user" + SYSTEM = "system" + USER_SYSTEM = "user,system" + + +class OsLicense(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """OsLicense.""" + + UNKNOWN = "Unknown" + YES = "Yes" + NO = "No" + + +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Operating System Type.""" + + LINUX = "Linux" + """Linux OS Type.""" + WINDOWS = "Windows" + """Windows OS Type.""" + + +class Percentile(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Percentile for Performance Data.""" + + PERCENTILE50 = "Percentile50" + """Percentile 50.""" + PERCENTILE90 = "Percentile90" + """Percentile 90.""" + PERCENTILE95 = "Percentile95" + """Percentile 95.""" + PERCENTILE99 = "Percentile99" + """Percentile 99.""" + + +class POSAzurePricingTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Pricing Tier for Azure.""" + + UNKNOWN = "Unknown" + """Unknown. Indicates missing data.""" + STANDARD = "Standard" + """Standard Pricing Tier.""" + + +class PricingTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Pricing Tier for Azure.""" + + STANDARD = "Standard" + """Standard Pricing Tier.""" + FREE = "Free" + """Free Pricing Tier.""" + + +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state.""" + + SUCCEEDED = "Succeeded" + CREATING = "Creating" + DELETING = "Deleting" + FAILED = "Failed" + + +class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The private endpoint connection status.""" + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + + +class ProjectStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Project Status.""" + + ACTIVE = "Active" + """Active Status.""" + INACTIVE = "Inactive" + """Inactive Status.""" + + +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of the current operation.""" + + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" + PROVISIONING = "Provisioning" + """Resource is being Provisioned.""" + UPDATING = "Updating" + """Resource is being Updated.""" + DELETING = "Deleting" + """Resource is being Deleted.""" + ACCEPTED = "Accepted" + """Resource is being Accepted.""" + + +class ProvisioningState2(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of the current operation.""" + + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" + PROVISIONING = "Provisioning" + """Resource is being Provisioned.""" + UPDATING = "Updating" + """Resource is being Updated.""" + DELETING = "Deleting" + """Resource is being Deleted.""" + ACCEPTED = "Accepted" + """Resource is being Accepted.""" + + +class ProvisioningStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning Status.""" + + UNKNOWN = "Unknown" + """Unknown. Indicates missing data.""" + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" + IN_PROGRESS = "InProgress" + """Provisioning is in Progress.""" + + +class Readiness(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Readiness for Azure.""" + + UNKNOWN = "Unknown" + """Unknown Readiness.""" + NOT_READY = "NotReady" + """Not Ready.""" + READY_WITH_CONDITIONS = "ReadyWithConditions" + """Ready with conditions.""" + READY = "Ready" + """Ready for migration.""" + + +class RecommendedSuitability(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """RecommendedSuitability.""" + + UNKNOWN = "Unknown" + SUITABLE_FOR_SQL_DB = "SuitableForSqlDB" + SUITABLE_FOR_SQL_MI = "SuitableForSqlMI" + SUITABLE_FOR_VM = "SuitableForVM" + POTENTIALLY_SUITABLE_FOR_VM = "PotentiallySuitableForVM" + READINESS_UNKNOWN = "ReadinessUnknown" + NOT_SUITABLE = "NotSuitable" + SUITABLE_FOR_SQL_VM = "SuitableForSqlVM" + CONDITIONALLY_SUITABLE_FOR_SQL_DB = "ConditionallySuitableForSqlDB" + CONDITIONALLY_SUITABLE_FOR_SQL_MI = "ConditionallySuitableForSqlMI" + CONDITIONALLY_SUITABLE_FOR_VM = "ConditionallySuitableForVM" + CONDITIONALLY_SUITABLE_FOR_SQL_VM = "ConditionallySuitableForSqlVM" + + +class ReportStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Business case supported report status types.""" + + UNKNOWN = "Unknown" + """Unknown Report Status.""" + NONE = "None" + """None Report Status.""" + IN_PROGRESS = "InProgress" + """InProgress Report Status.""" + FAILED = "Failed" + """Failed Report Status.""" + COMPLETED = "Completed" + """Completed Report Status.""" + + +class ReportType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Business case supported report types.""" + + UNKNOWN = "Unknown" + """Unknown Report Type.""" + EXCEL = "Excel" + """Excel Report Type.""" + + +class SavingsOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Business case supported Savings Option types.""" + + UNKNOWN = "Unknown" + """Unknown Savings Option.""" + RI3_YEAR = "RI3Year" + """Reserved Instance 3 Year.""" + SAVINGS_PLAN3_YEAR = "SavingsPlan3Year" + """Azure Savings Plan 3 Year.""" + + +class SavingsOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Savings Options for Azure.""" + + NONE = "None" + """Savings Options is not applicable.""" + ONE_YEAR_SAVINGS = "OneYearSavings" + """One Year Savings Plan.""" + THREE_YEARS_SAVINGS = "ThreeYearsSavings" + """Three Years Savings Plan.""" + ONE_YEAR_RESERVED = "OneYearReserved" + """One Year Reserved Instances.""" + THREE_YEARS_RESERVED = "ThreeYearsReserved" + """Three Years Reserved Instances.""" + + +class SkuReplicationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SkuReplicationMode.""" + + NOT_APPLICABLE = "NotApplicable" + ACTIVE_GEO_REPLICATION = "ActiveGeoReplication" + FAILOVER_GROUP_INSTANCE = "FailoverGroupInstance" + + +class SqlAssessmentMigrationIssueCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SqlAssessmentMigrationIssueCategory.""" + + ISSUE = "Issue" + WARNING = "Warning" + INTERNAL = "Internal" + + +class SqlFCIMetadataState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SqlFCIMetadataState.""" + + UNKNOWN = "Unknown" + INHERITED = "Inherited" + INITIALIZING = "Initializing" + ONLINE = "Online" + OFFLINE = "Offline" + FAILED = "Failed" + PENDING = "Pending" + ONLINE_PENDING = "OnlinePending" + OFFLINE_PENDING = "OfflinePending" + + +class SqlFCIState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SqlFCIState.""" + + UNKNOWN = "Unknown" + ACTIVE = "Active" + PASSIVE = "Passive" + NOT_APPLICABLE = "NotApplicable" + + +class SqlMigrationGuidelineCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SqlMigrationGuidelineCategory.""" + + UNKNOWN = "Unknown" + GENERAL = "General" + FAILOVER_CLUTER_INSTANCE_GUIDE_LINE = "FailoverCluterInstanceGuideLine" + AVAILABILITY_GROUP_GUIDELINE = "AvailabilityGroupGuideline" + + +class SqlServerLicense(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SqlServerLicense.""" + + UNKNOWN = "Unknown" + YES = "Yes" + NO = "No" + + +class SqlServerLicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Business case supported SQL Server License types.""" + + UNKNOWN = "Unknown" + """Unknown Sql Server License.""" + ENTERPRISE = "Enterprise" + """Enterprise Sql Server License.""" + STANDARD = "Standard" + """Standard Sql Server License.""" + + +class SuggestedMigrationTool(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Suggested Migration Tool for Azure.""" + + NONE = "None" + """No Migration Tool is suggested.""" + WEB_APP_MIGRATION = "WebAppMigration" + """Web App Migration.""" + SERVER_MIGRATION = "ServerMigration" + """Server Migration.""" + + +class Suitability(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Suitability for Azure.""" + + NOT_SUITABLE = "NotSuitable" + """Not Suitable for Azure.""" + SUITABLE = "Suitable" + """Suitable for Azure.""" + + +class SupportabilityStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Supportability Status.""" + + UNKNOWN = "Unknown" + """Unknown Supportability Status.""" + MAINSTREAM = "Mainstream" + """Mainstream Supportability Status.""" + EXTENDED = "Extended" + """Extended Supportability Status.""" + OUT_OF_SUPPORT = "OutOfSupport" + """OutOfSupport Supportability Status.""" + + +class TargetType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """TargetType.""" + + UNKNOWN = "Unknown" + RECOMMENDED = "Recommended" + AZURE_SQL_DATABASE = "AzureSqlDatabase" + AZURE_SQL_MANAGED_INSTANCE = "AzureSqlManagedInstance" + AZURE_SQL_VIRTUAL_MACHINE = "AzureSqlVirtualMachine" + AZURE_VIRTUAL_MACHINE = "AzureVirtualMachine" + + +class TimeRange(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Time Range for Performance Data.""" + + DAY = "Day" + """Daily.""" + WEEK = "Week" + """Weekly.""" + MONTH = "Month" + """Monthly.""" + CUSTOM = "Custom" + """Custom Time Range.""" + + +class VsphereManagementLicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Business case supported Vsphere Management License types.""" + + UNKNOWN = "Unknown" + """Unknown License.""" + V_SPHERE_SERVER_STANDARD = "VSphereServerStandard" + """VSphereServerStandard License.""" + + +class WebAppType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Web App Type.""" + + UNKNOWN = "Unknown" + """Unknown. Indicates Missing Data.""" + IIS = "IIS" + """ASP.NET Web App.""" + TOMCAT = "Tomcat" + """Java Web App.""" + + +class WebAppTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Business case supported WebApp types.""" + + UNKNOWN = "Unknown" + """Unknown WebApp Type.""" + ASPNET = "ASPNET" + """ASPNET Type.""" + JAVA = "Java" + """Java Tomcat Type.""" + + +class Year(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Year values.""" + + YEAR0 = "Year0" + """Year 0.""" + YEAR1 = "Year1" + """Year 1.""" + YEAR2 = "Year2" + """Year 2.""" + YEAR3 = "Year3" + """Year 3.""" diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/models/_models_py3.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/models/_models_py3.py new file mode 100644 index 000000000000..7e556030793f --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/models/_models_py3.py @@ -0,0 +1,17067 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from .. import _serialization + +if TYPE_CHECKING: + from .. import models as _models + + +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.migrationassessment.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.migrationassessment.models.SystemData + """ + + +class AKSAssessment(ProxyResource): + """ARM model of AKS Assessment. + + 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.AKSAssessmentProperties + :ivar e_tag: 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 e_tag: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "e_tag": {"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": "AKSAssessmentProperties"}, + "e_tag": {"key": "eTag", "type": "str"}, + } + + def __init__(self, *, properties: Optional["_models.AKSAssessmentProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.AKSAssessmentProperties + """ + super().__init__(**kwargs) + self.properties = properties + self.e_tag = None + + +class AssessmentDetails(_serialization.Model): + """Data model of Details of Assessment Computation. + + 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 prices_timestamp: Gets last time when rates were queried. + :vartype prices_timestamp: ~datetime.datetime + :ivar confidence_rating_in_percentage: Gets Confidence score. + :vartype confidence_rating_in_percentage: float + :ivar created_timestamp: Gets date and time when assessment was created. Required. + :vartype created_timestamp: ~datetime.datetime + :ivar updated_timestamp: Gets date and time when assessment was last updated. Required. + :vartype updated_timestamp: ~datetime.datetime + :ivar status: Gets assessment status. Required. Known values are: "Created", "Updated", + "Running", "Completed", "Invalid", "OutOfSync", "OutDated", and "Deleted". + :vartype status: str or ~azure.mgmt.migrationassessment.models.AssessmentStatus + """ + + _validation = { + "prices_timestamp": {"readonly": True}, + "confidence_rating_in_percentage": {"readonly": True}, + "created_timestamp": {"required": True, "readonly": True}, + "updated_timestamp": {"required": True, "readonly": True}, + "status": {"required": True, "readonly": True}, + } + + _attribute_map = { + "prices_timestamp": {"key": "pricesTimestamp", "type": "iso-8601"}, + "confidence_rating_in_percentage": {"key": "confidenceRatingInPercentage", "type": "float"}, + "created_timestamp": {"key": "createdTimestamp", "type": "iso-8601"}, + "updated_timestamp": {"key": "updatedTimestamp", "type": "iso-8601"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.prices_timestamp = None + self.confidence_rating_in_percentage = None + self.created_timestamp = None + self.updated_timestamp = None + self.status = None + + +class AKSAssessmentDetails(AssessmentDetails): + """Data model of AKS Assessment Details. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar prices_timestamp: Gets last time when rates were queried. + :vartype prices_timestamp: ~datetime.datetime + :ivar confidence_rating_in_percentage: Gets Confidence score. + :vartype confidence_rating_in_percentage: float + :ivar created_timestamp: Gets date and time when assessment was created. Required. + :vartype created_timestamp: ~datetime.datetime + :ivar updated_timestamp: Gets date and time when assessment was last updated. Required. + :vartype updated_timestamp: ~datetime.datetime + :ivar status: Gets assessment status. Required. Known values are: "Created", "Updated", + "Running", "Completed", "Invalid", "OutOfSync", "OutDated", and "Deleted". + :vartype status: str or ~azure.mgmt.migrationassessment.models.AssessmentStatus + :ivar web_app_count: Gets the number of web apps. Required. + :vartype web_app_count: int + :ivar web_server_count: Gets the number of web servers. Required. + :vartype web_server_count: int + :ivar machine_count: Gets the number of machines. Required. + :vartype machine_count: int + :ivar total_monthly_cost: Gets the total monthly cost. Required. + :vartype total_monthly_cost: float + """ + + _validation = { + "prices_timestamp": {"readonly": True}, + "confidence_rating_in_percentage": {"readonly": True}, + "created_timestamp": {"required": True, "readonly": True}, + "updated_timestamp": {"required": True, "readonly": True}, + "status": {"required": True, "readonly": True}, + "web_app_count": {"required": True, "readonly": True}, + "web_server_count": {"required": True, "readonly": True}, + "machine_count": {"required": True, "readonly": True}, + "total_monthly_cost": {"required": True, "readonly": True}, + } + + _attribute_map = { + "prices_timestamp": {"key": "pricesTimestamp", "type": "iso-8601"}, + "confidence_rating_in_percentage": {"key": "confidenceRatingInPercentage", "type": "float"}, + "created_timestamp": {"key": "createdTimestamp", "type": "iso-8601"}, + "updated_timestamp": {"key": "updatedTimestamp", "type": "iso-8601"}, + "status": {"key": "status", "type": "str"}, + "web_app_count": {"key": "webAppCount", "type": "int"}, + "web_server_count": {"key": "webServerCount", "type": "int"}, + "machine_count": {"key": "machineCount", "type": "int"}, + "total_monthly_cost": {"key": "totalMonthlyCost", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.web_app_count = None + self.web_server_count = None + self.machine_count = None + self.total_monthly_cost = None + + +class AKSAssessmentListResult(_serialization.Model): + """The response of a AKSAssessment list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The AKSAssessment items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.AKSAssessment] + :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": "[AKSAssessment]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.AKSAssessment"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The AKSAssessment items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.AKSAssessment] + :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 AKSAssessmentOptions(ProxyResource): + """ARM model of AKS Assessment Options. + + 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.AKSAssessmentOptionsProperties + :ivar e_tag: 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 e_tag: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "e_tag": {"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": "AKSAssessmentOptionsProperties"}, + "e_tag": {"key": "eTag", "type": "str"}, + } + + def __init__(self, *, properties: Optional["_models.AKSAssessmentOptionsProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.AKSAssessmentOptionsProperties + """ + super().__init__(**kwargs) + self.properties = properties + self.e_tag = None + + +class AKSAssessmentOptionsListResult(_serialization.Model): + """The response of a AKSAssessmentOptions list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The AKSAssessmentOptions items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.AKSAssessmentOptions] + :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": "[AKSAssessmentOptions]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.AKSAssessmentOptions"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The AKSAssessmentOptions items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.AKSAssessmentOptions] + :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 OptionsArmPropertiesBase(_serialization.Model): + """Base ARM model of ARM properties for assessment options. + + 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 edges: Gets the mapping of Assessment Options in graph representation. Required. + :vartype edges: dict[str, dict[str, list[str]]] + """ + + _validation = { + "edges": {"required": True, "readonly": True}, + } + + _attribute_map = { + "edges": {"key": "edges", "type": "{{[str]}}"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.edges = None + + +class AKSAssessmentOptionsProperties(OptionsArmPropertiesBase): + """ARM model of AKS Assessment Options 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 edges: Gets the mapping of Assessment Options in graph representation. Required. + :vartype edges: dict[str, dict[str, list[str]]] + """ + + +class MutableArmResource(_serialization.Model): + """ARM model of Assessment ARM object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Gets the provisioning state. Known values are: "Unknown", + "Succeeded", "Failed", "Canceled", and "InProgress". + :vartype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningStatus + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provisioning_state = None + + +class AssessmentPropertiesBase(MutableArmResource): + """Base ARM model of Assessment ARM properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Gets the provisioning state. Known values are: "Unknown", + "Succeeded", "Failed", "Canceled", and "InProgress". + :vartype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningStatus + :ivar scope: Gets or sets scope parameters to identify inventory items for assessment. + :vartype scope: ~azure.mgmt.migrationassessment.models.AssessmentScopeParameters + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "scope": {"key": "scope", "type": "AssessmentScopeParameters"}, + } + + def __init__(self, *, scope: Optional["_models.AssessmentScopeParameters"] = None, **kwargs: Any) -> None: + """ + :keyword scope: Gets or sets scope parameters to identify inventory items for assessment. + :paramtype scope: ~azure.mgmt.migrationassessment.models.AssessmentScopeParameters + """ + super().__init__(**kwargs) + self.scope = scope + + +class AKSAssessmentProperties(AssessmentPropertiesBase): + """ARM model of AKS Assessment 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 provisioning_state: Gets the provisioning state. Known values are: "Unknown", + "Succeeded", "Failed", "Canceled", and "InProgress". + :vartype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningStatus + :ivar scope: Gets or sets scope parameters to identify inventory items for assessment. + :vartype scope: ~azure.mgmt.migrationassessment.models.AssessmentScopeParameters + :ivar settings: Gets or sets AKS Assessment Settings. Required. + :vartype settings: ~azure.mgmt.migrationassessment.models.AKSAssessmentSettings + :ivar details: Gets AKS Assessment Details. + :vartype details: ~azure.mgmt.migrationassessment.models.AKSAssessmentDetails + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "settings": {"required": True}, + "details": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "scope": {"key": "scope", "type": "AssessmentScopeParameters"}, + "settings": {"key": "settings", "type": "AKSAssessmentSettings"}, + "details": {"key": "details", "type": "AKSAssessmentDetails"}, + } + + def __init__( + self, + *, + settings: "_models.AKSAssessmentSettings", + scope: Optional["_models.AssessmentScopeParameters"] = None, + **kwargs: Any + ) -> None: + """ + :keyword scope: Gets or sets scope parameters to identify inventory items for assessment. + :paramtype scope: ~azure.mgmt.migrationassessment.models.AssessmentScopeParameters + :keyword settings: Gets or sets AKS Assessment Settings. Required. + :paramtype settings: ~azure.mgmt.migrationassessment.models.AKSAssessmentSettings + """ + super().__init__(scope=scope, **kwargs) + self.settings = settings + self.details = None + + +class AssessmentSettings(_serialization.Model): + """Base data model of Assessment Settings. + + All required parameters must be populated in order to send to server. + + :ivar azure_location: Gets or sets azure location. Required. + :vartype azure_location: str + :ivar environment_type: Gets or sets environment type. Required. Known values are: "Unknown", + "DevTest", and "Production". + :vartype environment_type: str or ~azure.mgmt.migrationassessment.models.AzureEnvironmentType + :ivar licensing_program: Gets or sets licensing program. Required. Known values are: "Default" + and "EA". + :vartype licensing_program: str or ~azure.mgmt.migrationassessment.models.LicensingProgram + :ivar currency: Gets or sets currency. Required. Known values are: "Unknown", "USD", "DKK", + "CAD", "IDR", "JPY", "KRW", "NZD", "NOK", "RUB", "SAR", "ZAR", "SEK", "TRY", "GBP", "MXN", + "MYR", "INR", "HKD", "BRL", "TWD", "EUR", "CHF", "ARS", "AUD", "CNY", and "TRY". + :vartype currency: str or ~azure.mgmt.migrationassessment.models.AzureCurrency + :ivar discount_percentage: Gets or sets discount percentage. + :vartype discount_percentage: float + :ivar sizing_criteria: Gets or sets sizing criteria. Required. Known values are: + "PerformanceBased" and "AsOnPremises". + :vartype sizing_criteria: str or + ~azure.mgmt.migrationassessment.models.AssessmentSizingCriterion + :ivar performance_data: Gets or sets performance data settings. + :vartype performance_data: ~azure.mgmt.migrationassessment.models.PerfDataSettings + :ivar scaling_factor: Gets or sets scaling factor. + :vartype scaling_factor: float + """ + + _validation = { + "azure_location": {"required": True}, + "environment_type": {"required": True}, + "licensing_program": {"required": True}, + "currency": {"required": True}, + "sizing_criteria": {"required": True}, + } + + _attribute_map = { + "azure_location": {"key": "azureLocation", "type": "str"}, + "environment_type": {"key": "environmentType", "type": "str"}, + "licensing_program": {"key": "licensingProgram", "type": "str"}, + "currency": {"key": "currency", "type": "str"}, + "discount_percentage": {"key": "discountPercentage", "type": "float"}, + "sizing_criteria": {"key": "sizingCriteria", "type": "str"}, + "performance_data": {"key": "performanceData", "type": "PerfDataSettings"}, + "scaling_factor": {"key": "scalingFactor", "type": "float"}, + } + + def __init__( + self, + *, + azure_location: str, + environment_type: Union[str, "_models.AzureEnvironmentType"], + licensing_program: Union[str, "_models.LicensingProgram"], + currency: Union[str, "_models.AzureCurrency"], + sizing_criteria: Union[str, "_models.AssessmentSizingCriterion"], + discount_percentage: Optional[float] = None, + performance_data: Optional["_models.PerfDataSettings"] = None, + scaling_factor: Optional[float] = None, + **kwargs: Any + ) -> None: + """ + :keyword azure_location: Gets or sets azure location. Required. + :paramtype azure_location: str + :keyword environment_type: Gets or sets environment type. Required. Known values are: + "Unknown", "DevTest", and "Production". + :paramtype environment_type: str or ~azure.mgmt.migrationassessment.models.AzureEnvironmentType + :keyword licensing_program: Gets or sets licensing program. Required. Known values are: + "Default" and "EA". + :paramtype licensing_program: str or ~azure.mgmt.migrationassessment.models.LicensingProgram + :keyword currency: Gets or sets currency. Required. Known values are: "Unknown", "USD", "DKK", + "CAD", "IDR", "JPY", "KRW", "NZD", "NOK", "RUB", "SAR", "ZAR", "SEK", "TRY", "GBP", "MXN", + "MYR", "INR", "HKD", "BRL", "TWD", "EUR", "CHF", "ARS", "AUD", "CNY", and "TRY". + :paramtype currency: str or ~azure.mgmt.migrationassessment.models.AzureCurrency + :keyword discount_percentage: Gets or sets discount percentage. + :paramtype discount_percentage: float + :keyword sizing_criteria: Gets or sets sizing criteria. Required. Known values are: + "PerformanceBased" and "AsOnPremises". + :paramtype sizing_criteria: str or + ~azure.mgmt.migrationassessment.models.AssessmentSizingCriterion + :keyword performance_data: Gets or sets performance data settings. + :paramtype performance_data: ~azure.mgmt.migrationassessment.models.PerfDataSettings + :keyword scaling_factor: Gets or sets scaling factor. + :paramtype scaling_factor: float + """ + super().__init__(**kwargs) + self.azure_location = azure_location + self.environment_type = environment_type + self.licensing_program = licensing_program + self.currency = currency + self.discount_percentage = discount_percentage + self.sizing_criteria = sizing_criteria + self.performance_data = performance_data + self.scaling_factor = scaling_factor + + +class AKSAssessmentSettings(AssessmentSettings): + """Data model of AKS Assessment Settings. + + All required parameters must be populated in order to send to server. + + :ivar azure_location: Gets or sets azure location. Required. + :vartype azure_location: str + :ivar environment_type: Gets or sets environment type. Required. Known values are: "Unknown", + "DevTest", and "Production". + :vartype environment_type: str or ~azure.mgmt.migrationassessment.models.AzureEnvironmentType + :ivar licensing_program: Gets or sets licensing program. Required. Known values are: "Default" + and "EA". + :vartype licensing_program: str or ~azure.mgmt.migrationassessment.models.LicensingProgram + :ivar currency: Gets or sets currency. Required. Known values are: "Unknown", "USD", "DKK", + "CAD", "IDR", "JPY", "KRW", "NZD", "NOK", "RUB", "SAR", "ZAR", "SEK", "TRY", "GBP", "MXN", + "MYR", "INR", "HKD", "BRL", "TWD", "EUR", "CHF", "ARS", "AUD", "CNY", and "TRY". + :vartype currency: str or ~azure.mgmt.migrationassessment.models.AzureCurrency + :ivar discount_percentage: Gets or sets discount percentage. + :vartype discount_percentage: float + :ivar sizing_criteria: Gets or sets sizing criteria. Required. Known values are: + "PerformanceBased" and "AsOnPremises". + :vartype sizing_criteria: str or + ~azure.mgmt.migrationassessment.models.AssessmentSizingCriterion + :ivar performance_data: Gets or sets performance data settings. + :vartype performance_data: ~azure.mgmt.migrationassessment.models.PerfDataSettings + :ivar scaling_factor: Gets or sets scaling factor. + :vartype scaling_factor: float + :ivar category: Gets or sets azure VM category. Required. Known values are: "All", + "ComputeOptimized", "GeneralPurpose", "GpuOptimized", "HighPerformanceCompute", + "MemoryOptimized", "StorageOptimized", and "Isolated". + :vartype category: str or ~azure.mgmt.migrationassessment.models.AzureVmCategory + :ivar savings_options: Gets or sets savings options. Required. Known values are: "None", + "OneYearSavings", "ThreeYearsSavings", "OneYearReserved", and "ThreeYearsReserved". + :vartype savings_options: str or ~azure.mgmt.migrationassessment.models.SavingsOptions + :ivar consolidation: Gets or sets consolidation type. Required. Known values are: "Full" and + "AsOnSource". + :vartype consolidation: str or ~azure.mgmt.migrationassessment.models.ConsolidationType + :ivar pricing_tier: Gets or sets pricing tier. Required. Known values are: "Standard" and + "Free". + :vartype pricing_tier: str or ~azure.mgmt.migrationassessment.models.PricingTier + """ + + _validation = { + "azure_location": {"required": True}, + "environment_type": {"required": True}, + "licensing_program": {"required": True}, + "currency": {"required": True}, + "sizing_criteria": {"required": True}, + "category": {"required": True}, + "savings_options": {"required": True}, + "consolidation": {"required": True}, + "pricing_tier": {"required": True}, + } + + _attribute_map = { + "azure_location": {"key": "azureLocation", "type": "str"}, + "environment_type": {"key": "environmentType", "type": "str"}, + "licensing_program": {"key": "licensingProgram", "type": "str"}, + "currency": {"key": "currency", "type": "str"}, + "discount_percentage": {"key": "discountPercentage", "type": "float"}, + "sizing_criteria": {"key": "sizingCriteria", "type": "str"}, + "performance_data": {"key": "performanceData", "type": "PerfDataSettings"}, + "scaling_factor": {"key": "scalingFactor", "type": "float"}, + "category": {"key": "category", "type": "str"}, + "savings_options": {"key": "savingsOptions", "type": "str"}, + "consolidation": {"key": "consolidation", "type": "str"}, + "pricing_tier": {"key": "pricingTier", "type": "str"}, + } + + def __init__( + self, + *, + azure_location: str, + environment_type: Union[str, "_models.AzureEnvironmentType"], + licensing_program: Union[str, "_models.LicensingProgram"], + currency: Union[str, "_models.AzureCurrency"], + sizing_criteria: Union[str, "_models.AssessmentSizingCriterion"], + category: Union[str, "_models.AzureVmCategory"], + savings_options: Union[str, "_models.SavingsOptions"], + consolidation: Union[str, "_models.ConsolidationType"], + pricing_tier: Union[str, "_models.PricingTier"], + discount_percentage: Optional[float] = None, + performance_data: Optional["_models.PerfDataSettings"] = None, + scaling_factor: Optional[float] = None, + **kwargs: Any + ) -> None: + """ + :keyword azure_location: Gets or sets azure location. Required. + :paramtype azure_location: str + :keyword environment_type: Gets or sets environment type. Required. Known values are: + "Unknown", "DevTest", and "Production". + :paramtype environment_type: str or ~azure.mgmt.migrationassessment.models.AzureEnvironmentType + :keyword licensing_program: Gets or sets licensing program. Required. Known values are: + "Default" and "EA". + :paramtype licensing_program: str or ~azure.mgmt.migrationassessment.models.LicensingProgram + :keyword currency: Gets or sets currency. Required. Known values are: "Unknown", "USD", "DKK", + "CAD", "IDR", "JPY", "KRW", "NZD", "NOK", "RUB", "SAR", "ZAR", "SEK", "TRY", "GBP", "MXN", + "MYR", "INR", "HKD", "BRL", "TWD", "EUR", "CHF", "ARS", "AUD", "CNY", and "TRY". + :paramtype currency: str or ~azure.mgmt.migrationassessment.models.AzureCurrency + :keyword discount_percentage: Gets or sets discount percentage. + :paramtype discount_percentage: float + :keyword sizing_criteria: Gets or sets sizing criteria. Required. Known values are: + "PerformanceBased" and "AsOnPremises". + :paramtype sizing_criteria: str or + ~azure.mgmt.migrationassessment.models.AssessmentSizingCriterion + :keyword performance_data: Gets or sets performance data settings. + :paramtype performance_data: ~azure.mgmt.migrationassessment.models.PerfDataSettings + :keyword scaling_factor: Gets or sets scaling factor. + :paramtype scaling_factor: float + :keyword category: Gets or sets azure VM category. Required. Known values are: "All", + "ComputeOptimized", "GeneralPurpose", "GpuOptimized", "HighPerformanceCompute", + "MemoryOptimized", "StorageOptimized", and "Isolated". + :paramtype category: str or ~azure.mgmt.migrationassessment.models.AzureVmCategory + :keyword savings_options: Gets or sets savings options. Required. Known values are: "None", + "OneYearSavings", "ThreeYearsSavings", "OneYearReserved", and "ThreeYearsReserved". + :paramtype savings_options: str or ~azure.mgmt.migrationassessment.models.SavingsOptions + :keyword consolidation: Gets or sets consolidation type. Required. Known values are: "Full" and + "AsOnSource". + :paramtype consolidation: str or ~azure.mgmt.migrationassessment.models.ConsolidationType + :keyword pricing_tier: Gets or sets pricing tier. Required. Known values are: "Standard" and + "Free". + :paramtype pricing_tier: str or ~azure.mgmt.migrationassessment.models.PricingTier + """ + super().__init__( + azure_location=azure_location, + environment_type=environment_type, + licensing_program=licensing_program, + currency=currency, + discount_percentage=discount_percentage, + sizing_criteria=sizing_criteria, + performance_data=performance_data, + scaling_factor=scaling_factor, + **kwargs + ) + self.category = category + self.savings_options = savings_options + self.consolidation = consolidation + self.pricing_tier = pricing_tier + + +class AKSAssessmentSummary(_serialization.Model): + """Data model of AKS Assessment Summary. + + 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 sku_summary: Gets SKU summary. Required. + :vartype sku_summary: dict[str, ~azure.mgmt.migrationassessment.models.SummaryDetails] + :ivar web_app_summary: Gets web app summary. Required. + :vartype web_app_summary: dict[str, ~azure.mgmt.migrationassessment.models.SummaryDetails] + :ivar web_server_summary: Gets web server summary. Required. + :vartype web_server_summary: dict[str, int] + :ivar web_app_count: Gets the number of web apps. Required. + :vartype web_app_count: int + :ivar web_server_count: Gets the number of web servers. Required. + :vartype web_server_count: int + :ivar machine_count: Gets the number of machines. Required. + :vartype machine_count: int + :ivar total_monthly_cost: Gets the total monthly cost. Required. + :vartype total_monthly_cost: float + """ + + _validation = { + "sku_summary": {"required": True, "readonly": True}, + "web_app_summary": {"required": True, "readonly": True}, + "web_server_summary": {"required": True, "readonly": True}, + "web_app_count": {"required": True, "readonly": True}, + "web_server_count": {"required": True, "readonly": True}, + "machine_count": {"required": True, "readonly": True}, + "total_monthly_cost": {"required": True, "readonly": True}, + } + + _attribute_map = { + "sku_summary": {"key": "skuSummary", "type": "{SummaryDetails}"}, + "web_app_summary": {"key": "webAppSummary", "type": "{SummaryDetails}"}, + "web_server_summary": {"key": "webServerSummary", "type": "{int}"}, + "web_app_count": {"key": "webAppCount", "type": "int"}, + "web_server_count": {"key": "webServerCount", "type": "int"}, + "machine_count": {"key": "machineCount", "type": "int"}, + "total_monthly_cost": {"key": "totalMonthlyCost", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.sku_summary = None + self.web_app_summary = None + self.web_server_summary = None + self.web_app_count = None + self.web_server_count = None + self.machine_count = None + self.total_monthly_cost = None + + +class AKSCluster(ProxyResource): + """ARM model of AKS Cluster. + + 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.AKSClusterProperties + :ivar e_tag: 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 e_tag: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "e_tag": {"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": "AKSClusterProperties"}, + "e_tag": {"key": "eTag", "type": "str"}, + } + + def __init__(self, *, properties: Optional["_models.AKSClusterProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.AKSClusterProperties + """ + super().__init__(**kwargs) + self.properties = properties + self.e_tag = None + + +class AKSClusterListResult(_serialization.Model): + """The response of a AKSCluster list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The AKSCluster items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.AKSCluster] + :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": "[AKSCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.AKSCluster"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The AKSCluster items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.AKSCluster] + :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 Cluster(_serialization.Model): + """Data model of Cluster. + + 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 name: Gets name. Required. + :vartype name: str + :ivar node_pools: Gets list of node pools. Required. + :vartype node_pools: list[~azure.mgmt.migrationassessment.models.NodePool] + :ivar region: Gets region. Required. + :vartype region: str + :ivar user_node_pool_count: Gets user node pool count. Required. + :vartype user_node_pool_count: int + :ivar user_node_count: Gets user node count. Required. + :vartype user_node_count: int + :ivar system_node_pool_count: Gets system node pool count. Required. + :vartype system_node_pool_count: int + :ivar system_node_count: Gets system node count. Required. + :vartype system_node_count: int + :ivar pod_count: Gets pod count. Required. + :vartype pod_count: int + :ivar monthly_cost: Gets monthly cost. Required. + :vartype monthly_cost: float + """ + + _validation = { + "name": {"required": True, "readonly": True}, + "node_pools": {"required": True, "readonly": True}, + "region": {"required": True, "readonly": True}, + "user_node_pool_count": {"required": True, "readonly": True}, + "user_node_count": {"required": True, "readonly": True}, + "system_node_pool_count": {"required": True, "readonly": True}, + "system_node_count": {"required": True, "readonly": True}, + "pod_count": {"required": True, "readonly": True}, + "monthly_cost": {"required": True, "readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "node_pools": {"key": "nodePools", "type": "[NodePool]"}, + "region": {"key": "region", "type": "str"}, + "user_node_pool_count": {"key": "userNodePoolCount", "type": "int"}, + "user_node_count": {"key": "userNodeCount", "type": "int"}, + "system_node_pool_count": {"key": "systemNodePoolCount", "type": "int"}, + "system_node_count": {"key": "systemNodeCount", "type": "int"}, + "pod_count": {"key": "podCount", "type": "int"}, + "monthly_cost": {"key": "monthlyCost", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.node_pools = None + self.region = None + self.user_node_pool_count = None + self.user_node_count = None + self.system_node_pool_count = None + self.system_node_count = None + self.pod_count = None + self.monthly_cost = None + + +class AKSClusterProperties(Cluster): + """ARM model of AKS Cluster 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 name: Gets name. Required. + :vartype name: str + :ivar node_pools: Gets list of node pools. Required. + :vartype node_pools: list[~azure.mgmt.migrationassessment.models.NodePool] + :ivar region: Gets region. Required. + :vartype region: str + :ivar user_node_pool_count: Gets user node pool count. Required. + :vartype user_node_pool_count: int + :ivar user_node_count: Gets user node count. Required. + :vartype user_node_count: int + :ivar system_node_pool_count: Gets system node pool count. Required. + :vartype system_node_pool_count: int + :ivar system_node_count: Gets system node count. Required. + :vartype system_node_count: int + :ivar pod_count: Gets pod count. Required. + :vartype pod_count: int + :ivar monthly_cost: Gets monthly cost. Required. + :vartype monthly_cost: float + """ + + +class AKSCostDetail(ProxyResource): + """ARM model of AKS Cost Detail. + + 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.AKSCostDetailProperties + :ivar e_tag: 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 e_tag: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "e_tag": {"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": "AKSCostDetailProperties"}, + "e_tag": {"key": "eTag", "type": "str"}, + } + + def __init__(self, *, properties: Optional["_models.AKSCostDetailProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.AKSCostDetailProperties + """ + super().__init__(**kwargs) + self.properties = properties + self.e_tag = None + + +class AKSCostDetailListResult(_serialization.Model): + """The response of a AKSCostDetail list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The AKSCostDetail items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.AKSCostDetail] + :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": "[AKSCostDetail]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.AKSCostDetail"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The AKSCostDetail items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.AKSCostDetail] + :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 NodePool(_serialization.Model): + """Data model of Node Pool. + + 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: Gets id. Required. + :vartype id: str + :ivar name: Gets name. Required. + :vartype name: str + :ivar cluster_name: Gets cluster name. Required. + :vartype cluster_name: str + :ivar mode: Gets mode. Required. Known values are: "User" and "System". + :vartype mode: str or ~azure.mgmt.migrationassessment.models.NodePoolMode + :ivar os_type: Gets os type. Required. Known values are: "Linux" and "Windows". + :vartype os_type: str or ~azure.mgmt.migrationassessment.models.OSType + :ivar arm_sku_name: Gets arm sku name. Required. + :vartype arm_sku_name: str + :ivar node_count: Gets node count. Required. + :vartype node_count: int + :ivar pod_count: Gets pod count. Required. + :vartype pod_count: int + :ivar monthly_cost: Gets monthly cost. Required. + :vartype monthly_cost: float + :ivar pod_approx_monthly_cost: Gets pod approximate monthly cost. Required. + :vartype pod_approx_monthly_cost: float + """ + + _validation = { + "id": {"required": True, "readonly": True}, + "name": {"required": True, "readonly": True}, + "cluster_name": {"required": True, "readonly": True}, + "mode": {"required": True, "readonly": True}, + "os_type": {"required": True, "readonly": True}, + "arm_sku_name": {"required": True, "readonly": True}, + "node_count": {"required": True, "readonly": True}, + "pod_count": {"required": True, "readonly": True}, + "monthly_cost": {"required": True, "readonly": True}, + "pod_approx_monthly_cost": {"required": True, "readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "cluster_name": {"key": "clusterName", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "arm_sku_name": {"key": "armSkuName", "type": "str"}, + "node_count": {"key": "nodeCount", "type": "int"}, + "pod_count": {"key": "podCount", "type": "int"}, + "monthly_cost": {"key": "monthlyCost", "type": "float"}, + "pod_approx_monthly_cost": {"key": "podApproxMonthlyCost", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.cluster_name = None + self.mode = None + self.os_type = None + self.arm_sku_name = None + self.node_count = None + self.pod_count = None + self.monthly_cost = None + self.pod_approx_monthly_cost = None + + +class AKSCostDetailProperties(NodePool): + """ARM model of AKS Cost Detail 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: Gets id. Required. + :vartype id: str + :ivar name: Gets name. Required. + :vartype name: str + :ivar cluster_name: Gets cluster name. Required. + :vartype cluster_name: str + :ivar mode: Gets mode. Required. Known values are: "User" and "System". + :vartype mode: str or ~azure.mgmt.migrationassessment.models.NodePoolMode + :ivar os_type: Gets os type. Required. Known values are: "Linux" and "Windows". + :vartype os_type: str or ~azure.mgmt.migrationassessment.models.OSType + :ivar arm_sku_name: Gets arm sku name. Required. + :vartype arm_sku_name: str + :ivar node_count: Gets node count. Required. + :vartype node_count: int + :ivar pod_count: Gets pod count. Required. + :vartype pod_count: int + :ivar monthly_cost: Gets monthly cost. Required. + :vartype monthly_cost: float + :ivar pod_approx_monthly_cost: Gets pod approximate monthly cost. Required. + :vartype pod_approx_monthly_cost: float + """ + + +class AKSSummary(ProxyResource): + """ARM model of AKS Summary. + + 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.AKSSummaryProperties + :ivar e_tag: 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 e_tag: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "e_tag": {"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": "AKSSummaryProperties"}, + "e_tag": {"key": "eTag", "type": "str"}, + } + + def __init__(self, *, properties: Optional["_models.AKSSummaryProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.AKSSummaryProperties + """ + super().__init__(**kwargs) + self.properties = properties + self.e_tag = None + + +class AKSSummaryListResult(_serialization.Model): + """The response of a AKSSummary list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The AKSSummary items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.AKSSummary] + :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": "[AKSSummary]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.AKSSummary"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The AKSSummary items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.AKSSummary] + :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 SummaryPropertiesBase(_serialization.Model): + """Base ARM model of Assessment Summary ARM 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 assessment_name: Gets the assessment name. Required. + :vartype assessment_name: str + :ivar summary_name: Gets the summary name. Required. + :vartype summary_name: str + :ivar suitability_per_target: Gets the cloud suitability summary for all entities in the + assessment per target. Required. + :vartype suitability_per_target: dict[str, dict[str, int]] + :ivar monthly_compute_cost: Gets the monthly compute cost. Required. + :vartype monthly_compute_cost: float + :ivar monthly_storage_cost: Gets the monthly storage cost. Required. + :vartype monthly_storage_cost: float + :ivar confidence_score: Gets the confidence score. Required. + :vartype confidence_score: float + """ + + _validation = { + "assessment_name": {"required": True, "readonly": True}, + "summary_name": {"required": True, "readonly": True}, + "suitability_per_target": {"required": True, "readonly": True}, + "monthly_compute_cost": {"required": True, "readonly": True}, + "monthly_storage_cost": {"required": True, "readonly": True}, + "confidence_score": {"required": True, "readonly": True}, + } + + _attribute_map = { + "assessment_name": {"key": "assessmentName", "type": "str"}, + "summary_name": {"key": "summaryName", "type": "str"}, + "suitability_per_target": {"key": "suitabilityPerTarget", "type": "{{int}}"}, + "monthly_compute_cost": {"key": "monthlyComputeCost", "type": "float"}, + "monthly_storage_cost": {"key": "monthlyStorageCost", "type": "float"}, + "confidence_score": {"key": "confidenceScore", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.assessment_name = None + self.summary_name = None + self.suitability_per_target = None + self.monthly_compute_cost = None + self.monthly_storage_cost = None + self.confidence_score = None + + +class AKSSummaryProperties(SummaryPropertiesBase): + """ARM model of AKS Summary 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 assessment_name: Gets the assessment name. Required. + :vartype assessment_name: str + :ivar summary_name: Gets the summary name. Required. + :vartype summary_name: str + :ivar suitability_per_target: Gets the cloud suitability summary for all entities in the + assessment per target. Required. + :vartype suitability_per_target: dict[str, dict[str, int]] + :ivar monthly_compute_cost: Gets the monthly compute cost. Required. + :vartype monthly_compute_cost: float + :ivar monthly_storage_cost: Gets the monthly storage cost. Required. + :vartype monthly_storage_cost: float + :ivar confidence_score: Gets the confidence score. Required. + :vartype confidence_score: float + :ivar aks_assessment_summary: Gets AKS assessment summary. Required. + :vartype aks_assessment_summary: ~azure.mgmt.migrationassessment.models.AKSAssessmentSummary + """ + + _validation = { + "assessment_name": {"required": True, "readonly": True}, + "summary_name": {"required": True, "readonly": True}, + "suitability_per_target": {"required": True, "readonly": True}, + "monthly_compute_cost": {"required": True, "readonly": True}, + "monthly_storage_cost": {"required": True, "readonly": True}, + "confidence_score": {"required": True, "readonly": True}, + "aks_assessment_summary": {"required": True, "readonly": True}, + } + + _attribute_map = { + "assessment_name": {"key": "assessmentName", "type": "str"}, + "summary_name": {"key": "summaryName", "type": "str"}, + "suitability_per_target": {"key": "suitabilityPerTarget", "type": "{{int}}"}, + "monthly_compute_cost": {"key": "monthlyComputeCost", "type": "float"}, + "monthly_storage_cost": {"key": "monthlyStorageCost", "type": "float"}, + "confidence_score": {"key": "confidenceScore", "type": "float"}, + "aks_assessment_summary": {"key": "aksAssessmentSummary", "type": "AKSAssessmentSummary"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.aks_assessment_summary = None + + +class AppServiceSku(_serialization.Model): + """The app service SKU with corresponding cost. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar sku_name: The SKU name. + :vartype sku_name: str + :ivar cost: The cost details. + :vartype cost: float + :ivar count: The number of service plans recommended. + :vartype count: int + """ + + _validation = { + "sku_name": {"readonly": True}, + "cost": {"readonly": True}, + "count": {"readonly": True}, + } + + _attribute_map = { + "sku_name": {"key": "skuName", "type": "str"}, + "cost": {"key": "cost", "type": "float"}, + "count": {"key": "count", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.sku_name = None + self.cost = None + self.count = None + + +class AppSvcContainerSettings(_serialization.Model): + """App service container settings. + + All required parameters must be populated in order to send to server. + + :ivar isolation_required: Gets or sets the isolation required. Required. + :vartype isolation_required: bool + """ + + _validation = { + "isolation_required": {"required": True}, + } + + _attribute_map = { + "isolation_required": {"key": "isolationRequired", "type": "bool"}, + } + + def __init__(self, *, isolation_required: bool, **kwargs: Any) -> None: + """ + :keyword isolation_required: Gets or sets the isolation required. Required. + :paramtype isolation_required: bool + """ + super().__init__(**kwargs) + self.isolation_required = isolation_required + + +class AppSvcNativeSettings(_serialization.Model): + """App service native settings. + + All required parameters must be populated in order to send to server. + + :ivar isolation_required: Gets or sets the isolation required. Required. + :vartype isolation_required: bool + """ + + _validation = { + "isolation_required": {"required": True}, + } + + _attribute_map = { + "isolation_required": {"key": "isolationRequired", "type": "bool"}, + } + + def __init__(self, *, isolation_required: bool, **kwargs: Any) -> None: + """ + :keyword isolation_required: Gets or sets the isolation required. Required. + :paramtype isolation_required: bool + """ + super().__init__(**kwargs) + self.isolation_required = isolation_required + + +class AssessedDisk(_serialization.Model): + """Assessed disk properties class. + + :ivar suitability: Gets the suitability. Known values are: "Unknown", "NotSuitable", + "Suitable", "ConditionallySuitable", and "ReadinessUnknown". + :vartype suitability: str or ~azure.mgmt.migrationassessment.models.CloudSuitability + :ivar suitability_explanation: Gets the suitability explanation. Known values are: "Unknown", + "NotApplicable", "DiskSizeGreaterThanSupported", "NoSuitableDiskSizeForIops", + "NoSuitableDiskSizeForThroughput", "NoDiskSizeFoundInSelectedLocation", + "NoDiskSizeFoundForSelectedRedundancy", "InternalErrorOccurredForDiskEvaluation", and + "NoEaPriceFoundForDiskSize". + :vartype suitability_explanation: str or + ~azure.mgmt.migrationassessment.models.AzureDiskSuitabilityExplanation + :ivar suitability_detail: Gets the suitability detail. Known values are: "None", + "NumberOfReadOperationsPerSecondMissing", "NumberOfWriteOperationsPerSecondMissing", + "MegabytesPerSecondOfReadMissing", "MegabytesPerSecondOfWriteMissing", + "DiskGigabytesConsumedMissing", "DiskGigabytesProvisionedMissing", + "NumberOfReadOperationsPerSecondOutOfRange", "NumberOfWriteOperationsPerSecondOutOfRange", + "MegabytesPerSecondOfReadOutOfRange", "MegabytesPerSecondOfWriteOutOfRange", + "DiskGigabytesConsumedOutOfRange", and "DiskGigabytesProvisionedOutOfRange". + :vartype suitability_detail: str or + ~azure.mgmt.migrationassessment.models.AzureDiskSuitabilityDetail + :ivar recommended_disk_size: Gets the recommended disk size. Known values are: "Unknown", + "Standard_S4", "Standard_S6", "Standard_S10", "Standard_S15", "Standard_S20", "Standard_S30", + "Standard_S40", "Standard_S50", "Standard_S60", "Standard_S70", "Standard_S80", "Premium_P4", + "Premium_P6", "Premium_P10", "Premium_P15", "Premium_P20", "Premium_P30", "Premium_P40", + "Premium_P50", "Premium_P60", "Premium_P70", "Premium_P80", "StandardSSD_E10", + "StandardSSD_E15", "StandardSSD_E20", "StandardSSD_E30", "StandardSSD_E40", "StandardSSD_E50", + "StandardSSD_E60", "StandardSSD_E70", "StandardSSD_E80", "StandardSSD_E4", "StandardSSD_E6", + "StandardSSD_E1", "StandardSSD_E2", "StandardSSD_E3", "Premium_P1", "Premium_P2", "Premium_P3", + "Ultra", and "PremiumV2". + :vartype recommended_disk_size: str or ~azure.mgmt.migrationassessment.models.AzureDiskSize + :ivar recommended_disk_type: Gets the recommended disk type. Known values are: "Unknown", + "Standard", "StandardSSD", "Premium", "StandardOrPremium", "Ultra", and "PremiumV2". + :vartype recommended_disk_type: str or ~azure.mgmt.migrationassessment.models.AzureDiskType + :ivar gigabytes_for_recommended_disk_size: Gets the recommended disk size. + :vartype gigabytes_for_recommended_disk_size: int + :ivar recommend_disk_throughput_in_mbps: Gets the recommended disk throughput. + :vartype recommend_disk_throughput_in_mbps: float + :ivar recommended_disk_iops: Gets the recommended disk iops. + :vartype recommended_disk_iops: float + :ivar monthly_storage_cost: Gets the monthly storage cost. + :vartype monthly_storage_cost: float + :ivar name: Gets the name. + :vartype name: str + :ivar display_name: Gets the machine display name. + :vartype display_name: str + :ivar gigabytes_provisioned: Gets the gigabytes provisioned. + :vartype gigabytes_provisioned: float + :ivar megabytes_per_second_of_read: Gets the megabytes per second of read. + :vartype megabytes_per_second_of_read: float + :ivar megabytes_per_second_of_write: Gets the megabytes per second of write. + :vartype megabytes_per_second_of_write: float + :ivar number_of_read_operations_per_second: Gets the number of read operations per second. + :vartype number_of_read_operations_per_second: float + :ivar number_of_write_operations_per_second: Gets the number of write operations per second. + :vartype number_of_write_operations_per_second: float + """ + + _attribute_map = { + "suitability": {"key": "suitability", "type": "str"}, + "suitability_explanation": {"key": "suitabilityExplanation", "type": "str"}, + "suitability_detail": {"key": "suitabilityDetail", "type": "str"}, + "recommended_disk_size": {"key": "recommendedDiskSize", "type": "str"}, + "recommended_disk_type": {"key": "recommendedDiskType", "type": "str"}, + "gigabytes_for_recommended_disk_size": {"key": "gigabytesForRecommendedDiskSize", "type": "int"}, + "recommend_disk_throughput_in_mbps": {"key": "recommendDiskThroughputInMbps", "type": "float"}, + "recommended_disk_iops": {"key": "recommendedDiskIops", "type": "float"}, + "monthly_storage_cost": {"key": "monthlyStorageCost", "type": "float"}, + "name": {"key": "name", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "gigabytes_provisioned": {"key": "gigabytesProvisioned", "type": "float"}, + "megabytes_per_second_of_read": {"key": "megabytesPerSecondOfRead", "type": "float"}, + "megabytes_per_second_of_write": {"key": "megabytesPerSecondOfWrite", "type": "float"}, + "number_of_read_operations_per_second": {"key": "numberOfReadOperationsPerSecond", "type": "float"}, + "number_of_write_operations_per_second": {"key": "numberOfWriteOperationsPerSecond", "type": "float"}, + } + + def __init__( + self, + *, + suitability: Optional[Union[str, "_models.CloudSuitability"]] = None, + suitability_explanation: Optional[Union[str, "_models.AzureDiskSuitabilityExplanation"]] = None, + suitability_detail: Optional[Union[str, "_models.AzureDiskSuitabilityDetail"]] = None, + recommended_disk_size: Optional[Union[str, "_models.AzureDiskSize"]] = None, + recommended_disk_type: Optional[Union[str, "_models.AzureDiskType"]] = None, + gigabytes_for_recommended_disk_size: Optional[int] = None, + recommend_disk_throughput_in_mbps: Optional[float] = None, + recommended_disk_iops: Optional[float] = None, + monthly_storage_cost: Optional[float] = None, + name: Optional[str] = None, + display_name: Optional[str] = None, + gigabytes_provisioned: Optional[float] = None, + megabytes_per_second_of_read: Optional[float] = None, + megabytes_per_second_of_write: Optional[float] = None, + number_of_read_operations_per_second: Optional[float] = None, + number_of_write_operations_per_second: Optional[float] = None, + **kwargs: Any + ) -> None: + """ + :keyword suitability: Gets the suitability. Known values are: "Unknown", "NotSuitable", + "Suitable", "ConditionallySuitable", and "ReadinessUnknown". + :paramtype suitability: str or ~azure.mgmt.migrationassessment.models.CloudSuitability + :keyword suitability_explanation: Gets the suitability explanation. Known values are: + "Unknown", "NotApplicable", "DiskSizeGreaterThanSupported", "NoSuitableDiskSizeForIops", + "NoSuitableDiskSizeForThroughput", "NoDiskSizeFoundInSelectedLocation", + "NoDiskSizeFoundForSelectedRedundancy", "InternalErrorOccurredForDiskEvaluation", and + "NoEaPriceFoundForDiskSize". + :paramtype suitability_explanation: str or + ~azure.mgmt.migrationassessment.models.AzureDiskSuitabilityExplanation + :keyword suitability_detail: Gets the suitability detail. Known values are: "None", + "NumberOfReadOperationsPerSecondMissing", "NumberOfWriteOperationsPerSecondMissing", + "MegabytesPerSecondOfReadMissing", "MegabytesPerSecondOfWriteMissing", + "DiskGigabytesConsumedMissing", "DiskGigabytesProvisionedMissing", + "NumberOfReadOperationsPerSecondOutOfRange", "NumberOfWriteOperationsPerSecondOutOfRange", + "MegabytesPerSecondOfReadOutOfRange", "MegabytesPerSecondOfWriteOutOfRange", + "DiskGigabytesConsumedOutOfRange", and "DiskGigabytesProvisionedOutOfRange". + :paramtype suitability_detail: str or + ~azure.mgmt.migrationassessment.models.AzureDiskSuitabilityDetail + :keyword recommended_disk_size: Gets the recommended disk size. Known values are: "Unknown", + "Standard_S4", "Standard_S6", "Standard_S10", "Standard_S15", "Standard_S20", "Standard_S30", + "Standard_S40", "Standard_S50", "Standard_S60", "Standard_S70", "Standard_S80", "Premium_P4", + "Premium_P6", "Premium_P10", "Premium_P15", "Premium_P20", "Premium_P30", "Premium_P40", + "Premium_P50", "Premium_P60", "Premium_P70", "Premium_P80", "StandardSSD_E10", + "StandardSSD_E15", "StandardSSD_E20", "StandardSSD_E30", "StandardSSD_E40", "StandardSSD_E50", + "StandardSSD_E60", "StandardSSD_E70", "StandardSSD_E80", "StandardSSD_E4", "StandardSSD_E6", + "StandardSSD_E1", "StandardSSD_E2", "StandardSSD_E3", "Premium_P1", "Premium_P2", "Premium_P3", + "Ultra", and "PremiumV2". + :paramtype recommended_disk_size: str or ~azure.mgmt.migrationassessment.models.AzureDiskSize + :keyword recommended_disk_type: Gets the recommended disk type. Known values are: "Unknown", + "Standard", "StandardSSD", "Premium", "StandardOrPremium", "Ultra", and "PremiumV2". + :paramtype recommended_disk_type: str or ~azure.mgmt.migrationassessment.models.AzureDiskType + :keyword gigabytes_for_recommended_disk_size: Gets the recommended disk size. + :paramtype gigabytes_for_recommended_disk_size: int + :keyword recommend_disk_throughput_in_mbps: Gets the recommended disk throughput. + :paramtype recommend_disk_throughput_in_mbps: float + :keyword recommended_disk_iops: Gets the recommended disk iops. + :paramtype recommended_disk_iops: float + :keyword monthly_storage_cost: Gets the monthly storage cost. + :paramtype monthly_storage_cost: float + :keyword name: Gets the name. + :paramtype name: str + :keyword display_name: Gets the machine display name. + :paramtype display_name: str + :keyword gigabytes_provisioned: Gets the gigabytes provisioned. + :paramtype gigabytes_provisioned: float + :keyword megabytes_per_second_of_read: Gets the megabytes per second of read. + :paramtype megabytes_per_second_of_read: float + :keyword megabytes_per_second_of_write: Gets the megabytes per second of write. + :paramtype megabytes_per_second_of_write: float + :keyword number_of_read_operations_per_second: Gets the number of read operations per second. + :paramtype number_of_read_operations_per_second: float + :keyword number_of_write_operations_per_second: Gets the number of write operations per second. + :paramtype number_of_write_operations_per_second: float + """ + super().__init__(**kwargs) + self.suitability = suitability + self.suitability_explanation = suitability_explanation + self.suitability_detail = suitability_detail + self.recommended_disk_size = recommended_disk_size + self.recommended_disk_type = recommended_disk_type + self.gigabytes_for_recommended_disk_size = gigabytes_for_recommended_disk_size + self.recommend_disk_throughput_in_mbps = recommend_disk_throughput_in_mbps + self.recommended_disk_iops = recommended_disk_iops + self.monthly_storage_cost = monthly_storage_cost + self.name = name + self.display_name = display_name + self.gigabytes_provisioned = gigabytes_provisioned + self.megabytes_per_second_of_read = megabytes_per_second_of_read + self.megabytes_per_second_of_write = megabytes_per_second_of_write + self.number_of_read_operations_per_second = number_of_read_operations_per_second + self.number_of_write_operations_per_second = number_of_write_operations_per_second + + +class AssessedDiskData(_serialization.Model): + """Assessed Disk data. Used in Assessed SQL machine DTO. + + :ivar suitability: Gets the suitability. Known values are: "Unknown", "NotSuitable", + "Suitable", "ConditionallySuitable", and "ReadinessUnknown". + :vartype suitability: str or ~azure.mgmt.migrationassessment.models.CloudSuitability + :ivar suitability_explanation: Gets the suitability explanation. Known values are: "Unknown", + "NotApplicable", "DiskSizeGreaterThanSupported", "NoSuitableDiskSizeForIops", + "NoSuitableDiskSizeForThroughput", "NoDiskSizeFoundInSelectedLocation", + "NoDiskSizeFoundForSelectedRedundancy", "InternalErrorOccurredForDiskEvaluation", and + "NoEaPriceFoundForDiskSize". + :vartype suitability_explanation: str or + ~azure.mgmt.migrationassessment.models.AzureDiskSuitabilityExplanation + :ivar suitability_detail: Gets the suitability detail. Known values are: "None", + "NumberOfReadOperationsPerSecondMissing", "NumberOfWriteOperationsPerSecondMissing", + "MegabytesPerSecondOfReadMissing", "MegabytesPerSecondOfWriteMissing", + "DiskGigabytesConsumedMissing", "DiskGigabytesProvisionedMissing", + "NumberOfReadOperationsPerSecondOutOfRange", "NumberOfWriteOperationsPerSecondOutOfRange", + "MegabytesPerSecondOfReadOutOfRange", "MegabytesPerSecondOfWriteOutOfRange", + "DiskGigabytesConsumedOutOfRange", and "DiskGigabytesProvisionedOutOfRange". + :vartype suitability_detail: str or + ~azure.mgmt.migrationassessment.models.AzureDiskSuitabilityDetail + :ivar recommended_disk_size: Gets the recommended disk size. Known values are: "Unknown", + "Standard_S4", "Standard_S6", "Standard_S10", "Standard_S15", "Standard_S20", "Standard_S30", + "Standard_S40", "Standard_S50", "Standard_S60", "Standard_S70", "Standard_S80", "Premium_P4", + "Premium_P6", "Premium_P10", "Premium_P15", "Premium_P20", "Premium_P30", "Premium_P40", + "Premium_P50", "Premium_P60", "Premium_P70", "Premium_P80", "StandardSSD_E10", + "StandardSSD_E15", "StandardSSD_E20", "StandardSSD_E30", "StandardSSD_E40", "StandardSSD_E50", + "StandardSSD_E60", "StandardSSD_E70", "StandardSSD_E80", "StandardSSD_E4", "StandardSSD_E6", + "StandardSSD_E1", "StandardSSD_E2", "StandardSSD_E3", "Premium_P1", "Premium_P2", "Premium_P3", + "Ultra", and "PremiumV2". + :vartype recommended_disk_size: str or ~azure.mgmt.migrationassessment.models.AzureDiskSize + :ivar recommended_disk_type: Gets the recommended disk type. Known values are: "Unknown", + "Standard", "StandardSSD", "Premium", "StandardOrPremium", "Ultra", and "PremiumV2". + :vartype recommended_disk_type: str or ~azure.mgmt.migrationassessment.models.AzureDiskType + :ivar recommended_disk_size_gigabytes: Gets the recommended disk size. + :vartype recommended_disk_size_gigabytes: int + :ivar recommend_disk_throughput_in_mbps: Gets the recommended disk throughput. + :vartype recommend_disk_throughput_in_mbps: float + :ivar recommended_disk_iops: Gets the recommended disk iops. + :vartype recommended_disk_iops: float + :ivar monthly_storage_cost: Gets the monthly storage cost. + :vartype monthly_storage_cost: float + :ivar name: Gets the name. + :vartype name: str + :ivar display_name: Gets the machine display name. + :vartype display_name: str + :ivar gigabytes_provisioned: Gets the gigabytes provisioned. + :vartype gigabytes_provisioned: float + :ivar megabytes_per_second_of_read: Gets the megabytes per second of read. + :vartype megabytes_per_second_of_read: float + :ivar megabytes_per_second_of_write: Gets the megabytes per second of write. + :vartype megabytes_per_second_of_write: float + :ivar number_of_read_operations_per_second: Gets the number of read operations per second. + :vartype number_of_read_operations_per_second: float + :ivar number_of_write_operations_per_second: Gets the number of write operations per second. + :vartype number_of_write_operations_per_second: float + """ + + _attribute_map = { + "suitability": {"key": "suitability", "type": "str"}, + "suitability_explanation": {"key": "suitabilityExplanation", "type": "str"}, + "suitability_detail": {"key": "suitabilityDetail", "type": "str"}, + "recommended_disk_size": {"key": "recommendedDiskSize", "type": "str"}, + "recommended_disk_type": {"key": "recommendedDiskType", "type": "str"}, + "recommended_disk_size_gigabytes": {"key": "recommendedDiskSizeGigabytes", "type": "int"}, + "recommend_disk_throughput_in_mbps": {"key": "recommendDiskThroughputInMbps", "type": "float"}, + "recommended_disk_iops": {"key": "recommendedDiskIops", "type": "float"}, + "monthly_storage_cost": {"key": "monthlyStorageCost", "type": "float"}, + "name": {"key": "name", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "gigabytes_provisioned": {"key": "gigabytesProvisioned", "type": "float"}, + "megabytes_per_second_of_read": {"key": "megabytesPerSecondOfRead", "type": "float"}, + "megabytes_per_second_of_write": {"key": "megabytesPerSecondOfWrite", "type": "float"}, + "number_of_read_operations_per_second": {"key": "numberOfReadOperationsPerSecond", "type": "float"}, + "number_of_write_operations_per_second": {"key": "numberOfWriteOperationsPerSecond", "type": "float"}, + } + + def __init__( + self, + *, + suitability: Optional[Union[str, "_models.CloudSuitability"]] = None, + suitability_explanation: Optional[Union[str, "_models.AzureDiskSuitabilityExplanation"]] = None, + suitability_detail: Optional[Union[str, "_models.AzureDiskSuitabilityDetail"]] = None, + recommended_disk_size: Optional[Union[str, "_models.AzureDiskSize"]] = None, + recommended_disk_type: Optional[Union[str, "_models.AzureDiskType"]] = None, + recommended_disk_size_gigabytes: Optional[int] = None, + recommend_disk_throughput_in_mbps: Optional[float] = None, + recommended_disk_iops: Optional[float] = None, + monthly_storage_cost: Optional[float] = None, + name: Optional[str] = None, + display_name: Optional[str] = None, + gigabytes_provisioned: Optional[float] = None, + megabytes_per_second_of_read: Optional[float] = None, + megabytes_per_second_of_write: Optional[float] = None, + number_of_read_operations_per_second: Optional[float] = None, + number_of_write_operations_per_second: Optional[float] = None, + **kwargs: Any + ) -> None: + """ + :keyword suitability: Gets the suitability. Known values are: "Unknown", "NotSuitable", + "Suitable", "ConditionallySuitable", and "ReadinessUnknown". + :paramtype suitability: str or ~azure.mgmt.migrationassessment.models.CloudSuitability + :keyword suitability_explanation: Gets the suitability explanation. Known values are: + "Unknown", "NotApplicable", "DiskSizeGreaterThanSupported", "NoSuitableDiskSizeForIops", + "NoSuitableDiskSizeForThroughput", "NoDiskSizeFoundInSelectedLocation", + "NoDiskSizeFoundForSelectedRedundancy", "InternalErrorOccurredForDiskEvaluation", and + "NoEaPriceFoundForDiskSize". + :paramtype suitability_explanation: str or + ~azure.mgmt.migrationassessment.models.AzureDiskSuitabilityExplanation + :keyword suitability_detail: Gets the suitability detail. Known values are: "None", + "NumberOfReadOperationsPerSecondMissing", "NumberOfWriteOperationsPerSecondMissing", + "MegabytesPerSecondOfReadMissing", "MegabytesPerSecondOfWriteMissing", + "DiskGigabytesConsumedMissing", "DiskGigabytesProvisionedMissing", + "NumberOfReadOperationsPerSecondOutOfRange", "NumberOfWriteOperationsPerSecondOutOfRange", + "MegabytesPerSecondOfReadOutOfRange", "MegabytesPerSecondOfWriteOutOfRange", + "DiskGigabytesConsumedOutOfRange", and "DiskGigabytesProvisionedOutOfRange". + :paramtype suitability_detail: str or + ~azure.mgmt.migrationassessment.models.AzureDiskSuitabilityDetail + :keyword recommended_disk_size: Gets the recommended disk size. Known values are: "Unknown", + "Standard_S4", "Standard_S6", "Standard_S10", "Standard_S15", "Standard_S20", "Standard_S30", + "Standard_S40", "Standard_S50", "Standard_S60", "Standard_S70", "Standard_S80", "Premium_P4", + "Premium_P6", "Premium_P10", "Premium_P15", "Premium_P20", "Premium_P30", "Premium_P40", + "Premium_P50", "Premium_P60", "Premium_P70", "Premium_P80", "StandardSSD_E10", + "StandardSSD_E15", "StandardSSD_E20", "StandardSSD_E30", "StandardSSD_E40", "StandardSSD_E50", + "StandardSSD_E60", "StandardSSD_E70", "StandardSSD_E80", "StandardSSD_E4", "StandardSSD_E6", + "StandardSSD_E1", "StandardSSD_E2", "StandardSSD_E3", "Premium_P1", "Premium_P2", "Premium_P3", + "Ultra", and "PremiumV2". + :paramtype recommended_disk_size: str or ~azure.mgmt.migrationassessment.models.AzureDiskSize + :keyword recommended_disk_type: Gets the recommended disk type. Known values are: "Unknown", + "Standard", "StandardSSD", "Premium", "StandardOrPremium", "Ultra", and "PremiumV2". + :paramtype recommended_disk_type: str or ~azure.mgmt.migrationassessment.models.AzureDiskType + :keyword recommended_disk_size_gigabytes: Gets the recommended disk size. + :paramtype recommended_disk_size_gigabytes: int + :keyword recommend_disk_throughput_in_mbps: Gets the recommended disk throughput. + :paramtype recommend_disk_throughput_in_mbps: float + :keyword recommended_disk_iops: Gets the recommended disk iops. + :paramtype recommended_disk_iops: float + :keyword monthly_storage_cost: Gets the monthly storage cost. + :paramtype monthly_storage_cost: float + :keyword name: Gets the name. + :paramtype name: str + :keyword display_name: Gets the machine display name. + :paramtype display_name: str + :keyword gigabytes_provisioned: Gets the gigabytes provisioned. + :paramtype gigabytes_provisioned: float + :keyword megabytes_per_second_of_read: Gets the megabytes per second of read. + :paramtype megabytes_per_second_of_read: float + :keyword megabytes_per_second_of_write: Gets the megabytes per second of write. + :paramtype megabytes_per_second_of_write: float + :keyword number_of_read_operations_per_second: Gets the number of read operations per second. + :paramtype number_of_read_operations_per_second: float + :keyword number_of_write_operations_per_second: Gets the number of write operations per second. + :paramtype number_of_write_operations_per_second: float + """ + super().__init__(**kwargs) + self.suitability = suitability + self.suitability_explanation = suitability_explanation + self.suitability_detail = suitability_detail + self.recommended_disk_size = recommended_disk_size + self.recommended_disk_type = recommended_disk_type + self.recommended_disk_size_gigabytes = recommended_disk_size_gigabytes + self.recommend_disk_throughput_in_mbps = recommend_disk_throughput_in_mbps + self.recommended_disk_iops = recommended_disk_iops + self.monthly_storage_cost = monthly_storage_cost + self.name = name + self.display_name = display_name + self.gigabytes_provisioned = gigabytes_provisioned + self.megabytes_per_second_of_read = megabytes_per_second_of_read + self.megabytes_per_second_of_write = megabytes_per_second_of_write + self.number_of_read_operations_per_second = number_of_read_operations_per_second + self.number_of_write_operations_per_second = number_of_write_operations_per_second + + +class AssessedMachine(ProxyResource): + """Machine assessment Assessed Machine 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.AssessedMachineProperties + """ + + _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": "AssessedMachineProperties"}, + } + + def __init__(self, *, properties: Optional["_models.AssessedMachineProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.AssessedMachineProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class AssessedMachineListResult(_serialization.Model): + """The response of a AssessedMachine list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The AssessedMachine items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.AssessedMachine] + :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": "[AssessedMachine]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.AssessedMachine"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The AssessedMachine items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.AssessedMachine] + :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 AssessedMachineProperties(_serialization.Model): + """Assessed machine properties class. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar errors: List of errors for this machine. + :vartype errors: list[~azure.mgmt.migrationassessment.models.Error] + :ivar disks: Dictionary of disks attached to the machine. Key is ID of disk. Value is a disk + object. + :vartype disks: dict[str, ~azure.mgmt.migrationassessment.models.AssessedDisk] + :ivar monthly_ultra_storage_cost: Monthly ultra storage cost. + :vartype monthly_ultra_storage_cost: float + :ivar host_processor: Gets or sets the processor details of the host. + :vartype host_processor: ~azure.mgmt.migrationassessment.models.ProcessorInfo + :ivar cost_components: Gets or sets the collection of cost components. + :vartype cost_components: list[~azure.mgmt.migrationassessment.models.CostComponent] + :ivar product_support_status: Gets the product support status related details. + :vartype product_support_status: ~azure.mgmt.migrationassessment.models.ProductSupportStatus + :ivar monthly_bandwidth_cost: Monthly networking cost. + :vartype monthly_bandwidth_cost: float + :ivar monthly_storage_cost: Monthly storage cost. + :vartype monthly_storage_cost: float + :ivar monthly_premium_storage_cost: Monthly premium storage cost. + :vartype monthly_premium_storage_cost: float + :ivar monthly_standard_ssd_storage_cost: Monthly standard SSD storage cost. + :vartype monthly_standard_ssd_storage_cost: float + :ivar network_adapters: List of Network Adapters that were assessed as part of this machine's + assessment. + :vartype network_adapters: dict[str, + ~azure.mgmt.migrationassessment.models.AssessedNetworkAdapter] + :ivar recommended_size: Recommended Azure Size for the machine. Known values are: "Unknown", + "Basic_A0", "Basic_A1", "Basic_A2", "Basic_A3", "Basic_A4", "Standard_A0", "Standard_A1", + "Standard_A2", "Standard_A3", "Standard_A4", "Standard_A5", "Standard_A6", "Standard_A7", + "Standard_A8", "Standard_A9", "Standard_A10", "Standard_A11", "Standard_A1_v2", + "Standard_A2_v2", "Standard_A4_v2", "Standard_A8_v2", "Standard_A2m_v2", "Standard_A4m_v2", + "Standard_A8m_v2", "Standard_D1", "Standard_D2", "Standard_D3", "Standard_D4", "Standard_D11", + "Standard_D12", "Standard_D13", "Standard_D14", "Standard_D1_v2", "Standard_D2_v2", + "Standard_D3_v2", "Standard_D4_v2", "Standard_D5_v2", "Standard_D11_v2", "Standard_D12_v2", + "Standard_D13_v2", "Standard_D14_v2", "Standard_D15_v2", "Standard_DS1", "Standard_DS2", + "Standard_DS3", "Standard_DS4", "Standard_DS11", "Standard_DS12", "Standard_DS13", + "Standard_DS14", "Standard_DS1_v2", "Standard_DS2_v2", "Standard_DS3_v2", "Standard_DS4_v2", + "Standard_DS5_v2", "Standard_DS11_v2", "Standard_DS12_v2", "Standard_DS13_v2", + "Standard_DS14_v2", "Standard_DS15_v2", "Standard_F1", "Standard_F2", "Standard_F4", + "Standard_F8", "Standard_F16", "Standard_F1s", "Standard_F2s", "Standard_F4s", "Standard_F8s", + "Standard_F16s", "Standard_G1", "Standard_G2", "Standard_G3", "Standard_G4", "Standard_G5", + "Standard_GS1", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5", "Standard_H8", + "Standard_H16", "Standard_H8m", "Standard_H16m", "Standard_H16r", "Standard_H16mr", + "Standard_L4s", "Standard_L8s", "Standard_L16s", "Standard_L32s", "Standard_D2s_v3", + "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", + "Standard_D64s_v3", "Standard_D2_v3", "Standard_D4_v3", "Standard_D8_v3", "Standard_D16_v3", + "Standard_D32_v3", "Standard_D64_v3", "Standard_F2s_v2", "Standard_F4s_v2", "Standard_F8s_v2", + "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", + "Standard_E2_v3", "Standard_E4_v3", "Standard_E8_v3", "Standard_E16_v3", "Standard_E32_v3", + "Standard_E64_v3", "Standard_E2s_v3", "Standard_E4s_v3", "Standard_E8s_v3", "Standard_E16s_v3", + "Standard_E32s_v3", "Standard_E64s_v3", "Standard_M64s", "Standard_M64ms", "Standard_M128s", + "Standard_M128ms", "Standard_DC2s", "Standard_DC4s", "Standard_E20_v3", "Standard_E20s_v3", + "Standard_E64i_v3", "Standard_E64is_v3", "Standard_M8ms", "Standard_M16ms", "Standard_M32ls", + "Standard_M32ms", "Standard_M32ts", "Standard_M64", "Standard_M64ls", "Standard_M64m", + "Standard_M128", "Standard_M128m", "Standard_L8s_v2", "Standard_L16s_v2", "Standard_L32s_v2", + "Standard_L48s_v2", "Standard_L64s_v2", "Standard_L80s_v2", "Standard_D2_v4", "Standard_D4_v4", + "Standard_D8_v4", "Standard_D16_v4", "Standard_D32_v4", "Standard_D48_v4", "Standard_D64_v4", + "Standard_D2s_v4", "Standard_D4s_v4", "Standard_D8s_v4", "Standard_D16s_v4", + "Standard_D32s_v4", "Standard_D48s_v4", "Standard_D64s_v4", "Standard_D2d_v4", + "Standard_D4d_v4", "Standard_D8d_v4", "Standard_D16d_v4", "Standard_D32d_v4", + "Standard_D48d_v4", "Standard_D64d_v4", "Standard_D2ds_v4", "Standard_D4ds_v4", + "Standard_D8ds_v4", "Standard_D16ds_v4", "Standard_D32ds_v4", "Standard_D48ds_v4", + "Standard_D64ds_v4", "Standard_E2_v4", "Standard_E4_v4", "Standard_E8_v4", "Standard_E16_v4", + "Standard_E20_v4", "Standard_E32_v4", "Standard_E48_v4", "Standard_E64_v4", "Standard_E2s_v4", + "Standard_E4s_v4", "Standard_E8s_v4", "Standard_E16s_v4", "Standard_E20s_v4", + "Standard_E32s_v4", "Standard_E48s_v4", "Standard_E64s_v4", "Standard_E2d_v4", + "Standard_E4d_v4", "Standard_E8d_v4", "Standard_E16d_v4", "Standard_E20d_v4", + "Standard_E32d_v4", "Standard_E48d_v4", "Standard_E64d_v4", "Standard_E2ds_v4", + "Standard_E4ds_v4", "Standard_E8ds_v4", "Standard_E16ds_v4", "Standard_E20ds_v4", + "Standard_E32ds_v4", "Standard_E48ds_v4", "Standard_E64ds_v4", "Standard_E2as_v4", + "Standard_E4as_v4", "Standard_E8as_v4", "Standard_E16as_v4", "Standard_E20as_v4", + "Standard_E32as_v4", "Standard_E48as_v4", "Standard_E64as_v4", "Standard_E96as_v4", + "Standard_D2as_v4", "Standard_D4as_v4", "Standard_D8as_v4", "Standard_D16as_v4", + "Standard_D32as_v4", "Standard_D48as_v4", "Standard_D64as_v4", "Standard_D96as_v4", + "Standard_M208ms_v2", "Standard_M208s_v2", "Standard_M416ms_v2", "Standard_M416s_v2", + "Standard_F48s_v2", "Standard_E48_v3", "Standard_E48s_v3", "Standard_E80is_v4", + "Standard_E80ids_v4", "Standard_E2a_v4", "Standard_E4a_v4", "Standard_E8a_v4", + "Standard_E16a_v4", "Standard_E20a_v4", "Standard_E32a_v4", "Standard_E48a_v4", + "Standard_E64a_v4", "Standard_E96a_v4", "Standard_D2a_v4", "Standard_D4a_v4", + "Standard_D8a_v4", "Standard_D16a_v4", "Standard_D32a_v4", "Standard_D48a_v4", + "Standard_D64a_v4", "Standard_D96a_v4", "Standard_M32ms_v2", "Standard_M64s_v2", + "Standard_M64ms_v2", "Standard_M128s_v2", "Standard_M128ms_v2", "Standard_M192is_v2", + "Standard_M192ims_v2", "Standard_M32dms_v2", "Standard_M64ds_v2", "Standard_M64dms_v2", + "Standard_M128ds_v2", "Standard_M128dms_v2", "Standard_M192ids_v2", "Standard_M192idms_v2", + "Standard_D2_v5", "Standard_D4_v5", "Standard_D8_v5", "Standard_D16_v5", "Standard_D32_v5", + "Standard_D48_v5", "Standard_D64_v5", "Standard_D96_v5", "Standard_D2s_v5", "Standard_D4s_v5", + "Standard_D8s_v5", "Standard_D16s_v5", "Standard_D32s_v5", "Standard_D48s_v5", + "Standard_D64s_v5", "Standard_D96s_v5", "Standard_D2d_v5", "Standard_D4d_v5", + "Standard_D8d_v5", "Standard_D16d_v5", "Standard_D32d_v5", "Standard_D48d_v5", + "Standard_D64d_v5", "Standard_D96d_v5", "Standard_D2ds_v5", "Standard_D4ds_v5", + "Standard_D8ds_v5", "Standard_D16ds_v5", "Standard_D32ds_v5", "Standard_D48ds_v5", + "Standard_D64ds_v5", "Standard_D96ds_v5", "Standard_D2as_v5", "Standard_D4as_v5", + "Standard_D8as_v5", "Standard_D16as_v5", "Standard_D32as_v5", "Standard_D48as_v5", + "Standard_D64as_v5", "Standard_D96as_v5", "Standard_D2ads_v5", "Standard_D4ads_v5", + "Standard_D8ads_v5", "Standard_D16ads_v5", "Standard_D32ads_v5", "Standard_D48ads_v5", + "Standard_D64ads_v5", "Standard_D96ads_v5", "Standard_E2_v5", "Standard_E4_v5", + "Standard_E8_v5", "Standard_E16_v5", "Standard_E20_v5", "Standard_E32_v5", "Standard_E48_v5", + "Standard_E64_v5", "Standard_E96_v5", "Standard_E104i_v5", "Standard_E2s_v5", + "Standard_E4s_v5", "Standard_E8s_v5", "Standard_E16s_v5", "Standard_E20s_v5", + "Standard_E32s_v5", "Standard_E48s_v5", "Standard_E64s_v5", "Standard_E96s_v5", + "Standard_E104is_v5", "Standard_E2d_v5", "Standard_E4d_v5", "Standard_E8d_v5", + "Standard_E16d_v5", "Standard_E20d_v5", "Standard_E32d_v5", "Standard_E48d_v5", + "Standard_E64d_v5", "Standard_E96d_v5", "Standard_E104id_v5", "Standard_E2ds_v5", + "Standard_E4ds_v5", "Standard_E8ds_v5", "Standard_E16ds_v5", "Standard_E20ds_v5", + "Standard_E32ds_v5", "Standard_E48ds_v5", "Standard_E64ds_v5", "Standard_E96ds_v5", + "Standard_E104ids_v5", "Standard_E2as_v5", "Standard_E4as_v5", "Standard_E8as_v5", + "Standard_E16as_v5", "Standard_E20as_v5", "Standard_E32as_v5", "Standard_E48as_v5", + "Standard_E64as_v5", "Standard_E96as_v5", "Standard_E2ads_v5", "Standard_E4ads_v5", + "Standard_E8ads_v5", "Standard_E16ads_v5", "Standard_E20ads_v5", "Standard_E32ads_v5", + "Standard_E48ads_v5", "Standard_E64ads_v5", "Standard_E96ads_v5", "Standard_M8_2ms", + "Standard_M8_4ms", "Standard_M16_4ms", "Standard_M16_8ms", "Standard_M32_8ms", + "Standard_M32_16ms", "Standard_M64_32ms", "Standard_M64_16ms", "Standard_M128_64ms", + "Standard_M128_32ms", "Standard_E4_2s_v3", "Standard_E8_4s_v3", "Standard_E8_2s_v3", + "Standard_E16_8s_v3", "Standard_E16_4s_v3", "Standard_E32_16s_v3", "Standard_E32_8s_v3", + "Standard_E64_32s_v3", "Standard_E64_16s_v3", "Standard_E4_2s_v4", "Standard_E8_4s_v4", + "Standard_E8_2s_v4", "Standard_E16_8s_v4", "Standard_E16_4s_v4", "Standard_E32_16s_v4", + "Standard_E32_8s_v4", "Standard_E64_32s_v4", "Standard_E64_16s_v4", "Standard_E4_2ds_v4", + "Standard_E8_4ds_v4", "Standard_E8_2ds_v4", "Standard_E16_8ds_v4", "Standard_E16_4ds_v4", + "Standard_E32_16ds_v4", "Standard_E32_8ds_v4", "Standard_E64_32ds_v4", "Standard_E64_16ds_v4", + "Standard_E4_2as_v4", "Standard_E8_4as_v4", "Standard_E8_2as_v4", "Standard_E16_8as_v4", + "Standard_E16_4as_v4", "Standard_E32_16as_v4", "Standard_E32_8as_v4", "Standard_E64_32as_v4", + "Standard_E64_16as_v4", "Standard_E96_48as_v4", "Standard_E96_24as_v4", "Standard_E4_2ads_v5", + "Standard_E8_4ads_v5", "Standard_E8_2ads_v5", "Standard_E16_8ads_v5", "Standard_E16_4ads_v5", + "Standard_E32_16ads_v5", "Standard_E32_8ads_v5", "Standard_E64_32ads_v5", + "Standard_E64_16ads_v5", "Standard_E96_48ads_v5", "Standard_E96_24ads_v5", "Standard_E4_2s_v5", + "Standard_E8_4s_v5", "Standard_E8_2s_v5", "Standard_E16_8s_v5", "Standard_E16_4s_v5", + "Standard_E32_16s_v5", "Standard_E32_8s_v5", "Standard_E64_32s_v5", "Standard_E64_16s_v5", + "Standard_E96_48s_v5", "Standard_E96_24s_v5", "Standard_E4_2ds_v5", "Standard_E8_4ds_v5", + "Standard_E8_2ds_v5", "Standard_E16_8ds_v5", "Standard_E16_4ds_v5", "Standard_E32_16ds_v5", + "Standard_E32_8ds_v5", "Standard_E64_32ds_v5", "Standard_E64_16ds_v5", "Standard_E96_48ds_v5", + "Standard_E96_24ds_v5", "Standard_E4_2as_v5", "Standard_E8_4as_v5", "Standard_E8_2as_v5", + "Standard_E16_8as_v5", "Standard_E16_4as_v5", "Standard_E32_16as_v5", "Standard_E32_8as_v5", + "Standard_E64_32as_v5", "Standard_E64_16as_v5", "Standard_E96_48as_v5", "Standard_E96_24as_v5", + "Standard_GS4_8", "Standard_GS4_4", "Standard_GS5_16", "Standard_GS5_8", "Standard_DS11_1_v2", + "Standard_DS12_2_v2", "Standard_DS12_1_v2", "Standard_DS13_4_v2", "Standard_DS13_2_v2", + "Standard_DS14_8_v2", "Standard_DS14_4_v2", "Standard_M416_208s_v2", "Standard_M416_208ms_v2", + "Standard_E2bs_v5", "Standard_E4bs_v5", "Standard_E8bs_v5", "Standard_E16bs_v5", + "Standard_E32bs_v5", "Standard_E48bs_v5", "Standard_E64bs_v5", "Standard_E2bds_v5", + "Standard_E4bds_v5", "Standard_E8bds_v5", "Standard_E16bds_v5", "Standard_E32bds_v5", + "Standard_E48bds_v5", and "Standard_E64bds_v5". + :vartype recommended_size: str or ~azure.mgmt.migrationassessment.models.AzureVmSize + :ivar number_of_cores_for_recommended_size: Number of cores for recommended size. Read Only. + :vartype number_of_cores_for_recommended_size: int + :ivar megabytes_of_memory_for_recommended_size: Megabytes of memory for recommended size. Read + Only. + :vartype megabytes_of_memory_for_recommended_size: float + :ivar monthly_compute_cost_for_recommended_size: Monthly Compute cost calculated for + Recommended size, for a 31-day month. + :vartype monthly_compute_cost_for_recommended_size: float + :ivar suitability_explanation: Gets the explanation if machine is not suitable for cloud. Known + values are: "Unknown", "NotApplicable", "GuestOperatingSystemArchitectureNotSupported", + "GuestOperatingSystemNotSupported", "BootTypeNotSupported", "MoreDisksThanSupported", + "NoSuitableVmSizeFound", "OneOrMoreDisksNotSuitable", "OneOrMoreAdaptersNotSuitable", + "InternalErrorOccurredDuringComputeEvaluation", "InternalErrorOccurredDuringStorageEvaluation", + "InternalErrorOccurredDuringNetworkEvaluation", "NoVmSizeSupportsStoragePerformance", + "NoVmSizeSupportsNetworkPerformance", "NoVmSizeForSelectedPricingTier", + "NoVmSizeForSelectedAzureLocation", "CheckRedHatLinuxVersion", "CheckOpenSuseLinuxVersion", + "CheckWindowsServer2008R2Version", "CheckCentOsVersion", "CheckDebianLinuxVersion", + "CheckSuseLinuxVersion", "CheckOracleLinuxVersion", "CheckUbuntuLinuxVersion", + "CheckCoreOsLinuxVersion", "WindowsServerVersionConditionallySupported", + "NoGuestOperatingSystemConditionallySupported", "WindowsClientVersionsConditionallySupported", + "BootTypeUnknown", "GuestOperatingSystemUnknown", "WindowsServerVersionsSupportedWithCaveat", + "WindowsOSNoLongerUnderMSSupport", "EndorsedWithConditionsLinuxDistributions", + "UnendorsedLinuxDistributions", "NoVmSizeForStandardPricingTier", + "NoVmSizeForBasicPricingTier", "NoVmSizeInSelectedFamilyFound", "NoEaPriceFoundForVmSize", and + "NoVmSizeFoundForOfferCurrencyReservedInstance". + :vartype suitability_explanation: str or + ~azure.mgmt.migrationassessment.models.AzureVmSuitabilityExplanation + :ivar suitability_detail: Gets the details if machine is not suitable for cloud. Known values + are: "None", "RecommendedSizeHasLessNetworkAdapters", "CannotReportComputeCost", + "CannotReportStorageCost", "CannotReportBandwidthCosts", "PercentageOfCoresUtilizedMissing", + "PercentageOfMemoryUtilizedMissing", "PercentageOfCoresUtilizedOutOfRange", and + "PercentageOfMemoryUtilizedOutOfRange". + :vartype suitability_detail: str or + ~azure.mgmt.migrationassessment.models.AzureVmSuitabilityDetail + :ivar type: Assessed machine type. Known values are: "Unknown", "AssessedMachine", + "AvsAssessedMachine", and "SqlAssessedMachine". + :vartype type: str or ~azure.mgmt.migrationassessment.models.AssessedMachineType + :ivar boot_type: Boot type of machine discovered in private data center. Known values are: + "Unknown", "EFI", "BIOS", and "NotSpecified". + :vartype boot_type: str or ~azure.mgmt.migrationassessment.models.MachineBootType + :ivar operating_system_type: Operating system as reported by datacenter management solution. + :vartype operating_system_type: str + :ivar operating_system_name: Operating system as reported by datacenter management solution. + :vartype operating_system_name: str + :ivar operating_system_version: Operating system version as reported by datacenter management + solution. + :vartype operating_system_version: str + :ivar operating_system_architecture: Operating system architecture as reported by datacenter + management solution. Known values are: "Unknown", "X86", and "X64". + :vartype operating_system_architecture: str or + ~azure.mgmt.migrationassessment.models.GuestOperatingSystemArchitecture + :ivar created_timestamp: When was machine first created. + :vartype created_timestamp: ~datetime.datetime + :ivar updated_timestamp: When was machine last updated. + :vartype updated_timestamp: ~datetime.datetime + :ivar display_name: Display Name of the Machine. + :vartype display_name: str + :ivar description: Description for the machine. + :vartype description: str + :ivar datacenter_machine_arm_id: Data center machine ARM id. + :vartype datacenter_machine_arm_id: str + :ivar datacenter_management_server_arm_id: Data center management server ARM id. + :vartype datacenter_management_server_arm_id: str + :ivar datacenter_management_server_name: Data center management server name. + :vartype datacenter_management_server_name: str + :ivar megabytes_of_memory: Megabytes of memory found allocated for the machine in private data + center. + :vartype megabytes_of_memory: float + :ivar number_of_cores: Number of CPU cores found on the machine. + :vartype number_of_cores: int + :ivar confidence_rating_in_percentage: Confidence Rating in Percentage. + :vartype confidence_rating_in_percentage: float + :ivar percentage_cores_utilization: Percentile of Percentage of Cores Utilized noted during + time period T. + + Here N and T are settings on Assessment. + :vartype percentage_cores_utilization: float + :ivar percentage_memory_utilization: Percentile of Percentage of Memory Utilized noted during + time period T. + + .. code-block:: + + Here N and T are settings on Assessment. + :vartype percentage_memory_utilization: float + :ivar suitability: Gets a value indicating whether machine is suitable for the cloud platform + selected. Known values are: "Unknown", "NotSuitable", "Suitable", "ConditionallySuitable", and + "ReadinessUnknown". + :vartype suitability: str or ~azure.mgmt.migrationassessment.models.CloudSuitability + """ + + _validation = { + "errors": {"readonly": True}, + "disks": {"readonly": True}, + "monthly_ultra_storage_cost": {"readonly": True}, + "product_support_status": {"readonly": True}, + "monthly_bandwidth_cost": {"readonly": True}, + "monthly_storage_cost": {"readonly": True}, + "monthly_premium_storage_cost": {"readonly": True}, + "monthly_standard_ssd_storage_cost": {"readonly": True}, + "network_adapters": {"readonly": True}, + "recommended_size": {"readonly": True}, + "number_of_cores_for_recommended_size": {"readonly": True}, + "megabytes_of_memory_for_recommended_size": {"readonly": True}, + "monthly_compute_cost_for_recommended_size": {"readonly": True}, + "suitability_explanation": {"readonly": True}, + "suitability_detail": {"readonly": True}, + "type": {"readonly": True}, + "boot_type": {"readonly": True}, + "operating_system_type": {"readonly": True}, + "operating_system_name": {"readonly": True}, + "operating_system_version": {"readonly": True}, + "operating_system_architecture": {"readonly": True}, + "created_timestamp": {"readonly": True}, + "updated_timestamp": {"readonly": True}, + "display_name": {"readonly": True}, + "description": {"readonly": True}, + "datacenter_machine_arm_id": {"readonly": True}, + "datacenter_management_server_arm_id": {"readonly": True}, + "datacenter_management_server_name": {"readonly": True}, + "megabytes_of_memory": {"readonly": True}, + "number_of_cores": {"readonly": True}, + "confidence_rating_in_percentage": {"readonly": True}, + "percentage_cores_utilization": {"readonly": True}, + "percentage_memory_utilization": {"readonly": True}, + "suitability": {"readonly": True}, + } + + _attribute_map = { + "errors": {"key": "errors", "type": "[Error]"}, + "disks": {"key": "disks", "type": "{AssessedDisk}"}, + "monthly_ultra_storage_cost": {"key": "monthlyUltraStorageCost", "type": "float"}, + "host_processor": {"key": "hostProcessor", "type": "ProcessorInfo"}, + "cost_components": {"key": "costComponents", "type": "[CostComponent]"}, + "product_support_status": {"key": "productSupportStatus", "type": "ProductSupportStatus"}, + "monthly_bandwidth_cost": {"key": "monthlyBandwidthCost", "type": "float"}, + "monthly_storage_cost": {"key": "monthlyStorageCost", "type": "float"}, + "monthly_premium_storage_cost": {"key": "monthlyPremiumStorageCost", "type": "float"}, + "monthly_standard_ssd_storage_cost": {"key": "monthlyStandardSsdStorageCost", "type": "float"}, + "network_adapters": {"key": "networkAdapters", "type": "{AssessedNetworkAdapter}"}, + "recommended_size": {"key": "recommendedSize", "type": "str"}, + "number_of_cores_for_recommended_size": {"key": "numberOfCoresForRecommendedSize", "type": "int"}, + "megabytes_of_memory_for_recommended_size": {"key": "megabytesOfMemoryForRecommendedSize", "type": "float"}, + "monthly_compute_cost_for_recommended_size": {"key": "monthlyComputeCostForRecommendedSize", "type": "float"}, + "suitability_explanation": {"key": "suitabilityExplanation", "type": "str"}, + "suitability_detail": {"key": "suitabilityDetail", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "boot_type": {"key": "bootType", "type": "str"}, + "operating_system_type": {"key": "operatingSystemType", "type": "str"}, + "operating_system_name": {"key": "operatingSystemName", "type": "str"}, + "operating_system_version": {"key": "operatingSystemVersion", "type": "str"}, + "operating_system_architecture": {"key": "operatingSystemArchitecture", "type": "str"}, + "created_timestamp": {"key": "createdTimestamp", "type": "iso-8601"}, + "updated_timestamp": {"key": "updatedTimestamp", "type": "iso-8601"}, + "display_name": {"key": "displayName", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "datacenter_machine_arm_id": {"key": "datacenterMachineArmId", "type": "str"}, + "datacenter_management_server_arm_id": {"key": "datacenterManagementServerArmId", "type": "str"}, + "datacenter_management_server_name": {"key": "datacenterManagementServerName", "type": "str"}, + "megabytes_of_memory": {"key": "megabytesOfMemory", "type": "float"}, + "number_of_cores": {"key": "numberOfCores", "type": "int"}, + "confidence_rating_in_percentage": {"key": "confidenceRatingInPercentage", "type": "float"}, + "percentage_cores_utilization": {"key": "percentageCoresUtilization", "type": "float"}, + "percentage_memory_utilization": {"key": "percentageMemoryUtilization", "type": "float"}, + "suitability": {"key": "suitability", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + host_processor: Optional["_models.ProcessorInfo"] = None, + cost_components: Optional[List["_models.CostComponent"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword host_processor: Gets or sets the processor details of the host. + :paramtype host_processor: ~azure.mgmt.migrationassessment.models.ProcessorInfo + :keyword cost_components: Gets or sets the collection of cost components. + :paramtype cost_components: list[~azure.mgmt.migrationassessment.models.CostComponent] + """ + super().__init__(**kwargs) + self.errors = None + self.disks = None + self.monthly_ultra_storage_cost = None + self.host_processor = host_processor + self.cost_components = cost_components + self.product_support_status = None + self.monthly_bandwidth_cost = None + self.monthly_storage_cost = None + self.monthly_premium_storage_cost = None + self.monthly_standard_ssd_storage_cost = None + self.network_adapters = None + self.recommended_size = None + self.number_of_cores_for_recommended_size = None + self.megabytes_of_memory_for_recommended_size = None + self.monthly_compute_cost_for_recommended_size = None + self.suitability_explanation = None + self.suitability_detail = None + self.type = None + self.boot_type = None + self.operating_system_type = None + self.operating_system_name = None + self.operating_system_version = None + self.operating_system_architecture = None + self.created_timestamp = None + self.updated_timestamp = None + self.display_name = None + self.description = None + self.datacenter_machine_arm_id = None + self.datacenter_management_server_arm_id = None + self.datacenter_management_server_name = None + self.megabytes_of_memory = None + self.number_of_cores = None + self.confidence_rating_in_percentage = None + self.percentage_cores_utilization = None + self.percentage_memory_utilization = None + self.suitability = None + + +class AssessedNetworkAdapter(_serialization.Model): + """Assessed Network Adapter. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar suitability: Gets the suitability. Known values are: "Unknown", "NotSuitable", + "Suitable", "ConditionallySuitable", and "ReadinessUnknown". + :vartype suitability: str or ~azure.mgmt.migrationassessment.models.CloudSuitability + :ivar suitability_detail: Gets the suitability detail. Known values are: "None", + "MegabytesOfDataTransmittedMissing", "MegabytesOfDataTransmittedOutOfRange", + "MegabytesOfDataRecievedMissing", and "MegabytesOfDataRecievedOutOfRange". + :vartype suitability_detail: str or + ~azure.mgmt.migrationassessment.models.AzureNetworkAdapterSuitabilityDetail + :ivar suitability_explanation: Gets the suitability explanation. Known values are: "Unknown", + "NotApplicable", and "InternalErrorOccurred". + :vartype suitability_explanation: str or + ~azure.mgmt.migrationassessment.models.AzureNetworkAdapterSuitabilityExplanation + :ivar monthly_bandwidth_costs: Gets the monthly bandwidth costs. + :vartype monthly_bandwidth_costs: float + :ivar net_gigabytes_transmitted_per_month: Gets the net gigabytes transmitted per month. + :vartype net_gigabytes_transmitted_per_month: float + :ivar display_name: Gets the display name. + :vartype display_name: str + :ivar mac_address: Gets the mac address. + :vartype mac_address: str + :ivar ip_addresses: Gets the ip addresses. + :vartype ip_addresses: list[str] + :ivar megabytes_per_second_received: Gets the megabytes per second received. + :vartype megabytes_per_second_received: float + :ivar megabytes_per_second_transmitted: Gets the megabytes per second transmitted. + :vartype megabytes_per_second_transmitted: float + """ + + _validation = { + "ip_addresses": {"readonly": True}, + } + + _attribute_map = { + "suitability": {"key": "suitability", "type": "str"}, + "suitability_detail": {"key": "suitabilityDetail", "type": "str"}, + "suitability_explanation": {"key": "suitabilityExplanation", "type": "str"}, + "monthly_bandwidth_costs": {"key": "monthlyBandwidthCosts", "type": "float"}, + "net_gigabytes_transmitted_per_month": {"key": "netGigabytesTransmittedPerMonth", "type": "float"}, + "display_name": {"key": "displayName", "type": "str"}, + "mac_address": {"key": "macAddress", "type": "str"}, + "ip_addresses": {"key": "ipAddresses", "type": "[str]"}, + "megabytes_per_second_received": {"key": "megabytesPerSecondReceived", "type": "float"}, + "megabytes_per_second_transmitted": {"key": "megabytesPerSecondTransmitted", "type": "float"}, + } + + def __init__( + self, + *, + suitability: Optional[Union[str, "_models.CloudSuitability"]] = None, + suitability_detail: Optional[Union[str, "_models.AzureNetworkAdapterSuitabilityDetail"]] = None, + suitability_explanation: Optional[Union[str, "_models.AzureNetworkAdapterSuitabilityExplanation"]] = None, + monthly_bandwidth_costs: Optional[float] = None, + net_gigabytes_transmitted_per_month: Optional[float] = None, + display_name: Optional[str] = None, + mac_address: Optional[str] = None, + megabytes_per_second_received: Optional[float] = None, + megabytes_per_second_transmitted: Optional[float] = None, + **kwargs: Any + ) -> None: + """ + :keyword suitability: Gets the suitability. Known values are: "Unknown", "NotSuitable", + "Suitable", "ConditionallySuitable", and "ReadinessUnknown". + :paramtype suitability: str or ~azure.mgmt.migrationassessment.models.CloudSuitability + :keyword suitability_detail: Gets the suitability detail. Known values are: "None", + "MegabytesOfDataTransmittedMissing", "MegabytesOfDataTransmittedOutOfRange", + "MegabytesOfDataRecievedMissing", and "MegabytesOfDataRecievedOutOfRange". + :paramtype suitability_detail: str or + ~azure.mgmt.migrationassessment.models.AzureNetworkAdapterSuitabilityDetail + :keyword suitability_explanation: Gets the suitability explanation. Known values are: + "Unknown", "NotApplicable", and "InternalErrorOccurred". + :paramtype suitability_explanation: str or + ~azure.mgmt.migrationassessment.models.AzureNetworkAdapterSuitabilityExplanation + :keyword monthly_bandwidth_costs: Gets the monthly bandwidth costs. + :paramtype monthly_bandwidth_costs: float + :keyword net_gigabytes_transmitted_per_month: Gets the net gigabytes transmitted per month. + :paramtype net_gigabytes_transmitted_per_month: float + :keyword display_name: Gets the display name. + :paramtype display_name: str + :keyword mac_address: Gets the mac address. + :paramtype mac_address: str + :keyword megabytes_per_second_received: Gets the megabytes per second received. + :paramtype megabytes_per_second_received: float + :keyword megabytes_per_second_transmitted: Gets the megabytes per second transmitted. + :paramtype megabytes_per_second_transmitted: float + """ + super().__init__(**kwargs) + self.suitability = suitability + self.suitability_detail = suitability_detail + self.suitability_explanation = suitability_explanation + self.monthly_bandwidth_costs = monthly_bandwidth_costs + self.net_gigabytes_transmitted_per_month = net_gigabytes_transmitted_per_month + self.display_name = display_name + self.mac_address = mac_address + self.ip_addresses = None + self.megabytes_per_second_received = megabytes_per_second_received + self.megabytes_per_second_transmitted = megabytes_per_second_transmitted + + +class AssessedSqlDatabaseV2(ProxyResource): + """Assessed SQL database web model class. + + 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.AssessedSqlDatabaseV2Properties + """ + + _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": "AssessedSqlDatabaseV2Properties"}, + } + + def __init__( + self, *, properties: Optional["_models.AssessedSqlDatabaseV2Properties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.AssessedSqlDatabaseV2Properties + """ + super().__init__(**kwargs) + self.properties = properties + + +class AssessedSqlDatabaseV2ListResult(_serialization.Model): + """The response of a AssessedSqlDatabaseV2 list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The AssessedSqlDatabaseV2 items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.AssessedSqlDatabaseV2] + :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": "[AssessedSqlDatabaseV2]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.AssessedSqlDatabaseV2"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The AssessedSqlDatabaseV2 items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.AssessedSqlDatabaseV2] + :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 AssessedSqlDatabaseV2Properties(_serialization.Model): + """Assessed SQL database properties web model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar recommended_azure_sql_target_type: Gets or sets the recommended azure SQL target type. + Known values are: "Unknown", "Recommended", "AzureSqlDatabase", "AzureSqlManagedInstance", + "AzureSqlVirtualMachine", and "AzureVirtualMachine". + :vartype recommended_azure_sql_target_type: str or + ~azure.mgmt.migrationassessment.models.TargetType + :ivar recommended_suitability: Gets or sets the recommended azure SQL suitability. Known values + are: "Unknown", "SuitableForSqlDB", "SuitableForSqlMI", "SuitableForVM", + "PotentiallySuitableForVM", "ReadinessUnknown", "NotSuitable", "SuitableForSqlVM", + "ConditionallySuitableForSqlDB", "ConditionallySuitableForSqlMI", "ConditionallySuitableForVM", + and "ConditionallySuitableForSqlVM". + :vartype recommended_suitability: str or + ~azure.mgmt.migrationassessment.models.RecommendedSuitability + :ivar buffer_cache_size_in_mb: Gets or sets the aggregated cache size of this database. This is + a performance + data metric for this DB. + :vartype buffer_cache_size_in_mb: float + :ivar product_support_status: Gets the product support status related details. + :vartype product_support_status: ~azure.mgmt.migrationassessment.models.ProductSupportStatus + :ivar azure_sql_mi_suitability_details: Gets or sets the azure SQL MI suitability details. + :vartype azure_sql_mi_suitability_details: + ~azure.mgmt.migrationassessment.models.SqlAssessmentV2PaasSuitabilityData + :ivar azure_sql_db_suitability_details: Gets or sets the azure SQL DB suitability details. + :vartype azure_sql_db_suitability_details: + ~azure.mgmt.migrationassessment.models.SqlAssessmentV2PaasSuitabilityData + :ivar is_database_highly_available: Gets a value indicating whether the assessed SQL database + is highly available + or not. + :vartype is_database_highly_available: bool + :ivar linked_availability_group_overview: Gets the linked availability group overview if the + database being assessed is + highly available. + :vartype linked_availability_group_overview: + ~azure.mgmt.migrationassessment.models.SqlAvailabilityGroupDataOverview + :ivar machine_arm_id: Machine arm id. + :vartype machine_arm_id: str + :ivar assessed_sql_instance_arm_id: Assessed SQL instance arm id. + :vartype assessed_sql_instance_arm_id: str + :ivar machine_name: Machine display name. + :vartype machine_name: str + :ivar instance_name: SQL instance name. + :vartype instance_name: str + :ivar database_name: SQL database name. + :vartype database_name: str + :ivar database_size_in_mb: SQL database size in megabytes. + :vartype database_size_in_mb: float + :ivar compatibility_level: Database compatibility level. Known values are: "Unknown", + "CompatLevel80", "CompatLevel90", "CompatLevel100", "CompatLevel110", "CompatLevel120", + "CompatLevel130", "CompatLevel140", and "CompatLevel150". + :vartype compatibility_level: str or ~azure.mgmt.migrationassessment.models.CompatibilityLevel + :ivar sql_database_sds_arm_id: SQL database SDS arm id. + :vartype sql_database_sds_arm_id: str + :ivar percentage_cores_utilization: The percentage of the total number of cores being utilized + by the SQL database. + :vartype percentage_cores_utilization: float + :ivar megabytes_per_second_of_read: The read throughput of the SQL database. + :vartype megabytes_per_second_of_read: float + :ivar megabytes_per_second_of_write: The write throughput of the SQL database. + :vartype megabytes_per_second_of_write: float + :ivar number_of_read_operations_per_second: The read operations per second of the SQL database. + :vartype number_of_read_operations_per_second: float + :ivar number_of_write_operations_per_second: The write operations per second of the SQL + database. + :vartype number_of_write_operations_per_second: float + :ivar confidence_rating_in_percentage: Confidence Rating in Percentage. + :vartype confidence_rating_in_percentage: float + :ivar sizing_criterion: Assessment sizing criterion. Known values are: "PerformanceBased" and + "AsOnPremises". + :vartype sizing_criterion: str or + ~azure.mgmt.migrationassessment.models.AssessmentSizingCriterion + :ivar created_timestamp: When was assessed SQL database first created. + :vartype created_timestamp: ~datetime.datetime + :ivar updated_timestamp: When was assessed SQL database last updated. + :vartype updated_timestamp: ~datetime.datetime + """ + + _validation = { + "recommended_azure_sql_target_type": {"readonly": True}, + "recommended_suitability": {"readonly": True}, + "buffer_cache_size_in_mb": {"readonly": True}, + "product_support_status": {"readonly": True}, + "azure_sql_mi_suitability_details": {"readonly": True}, + "azure_sql_db_suitability_details": {"readonly": True}, + "is_database_highly_available": {"readonly": True}, + "linked_availability_group_overview": {"readonly": True}, + "machine_arm_id": {"readonly": True}, + "assessed_sql_instance_arm_id": {"readonly": True}, + "machine_name": {"readonly": True}, + "instance_name": {"readonly": True}, + "database_name": {"readonly": True}, + "database_size_in_mb": {"readonly": True}, + "compatibility_level": {"readonly": True}, + "sql_database_sds_arm_id": {"readonly": True}, + "percentage_cores_utilization": {"readonly": True}, + "megabytes_per_second_of_read": {"readonly": True}, + "megabytes_per_second_of_write": {"readonly": True}, + "number_of_read_operations_per_second": {"readonly": True}, + "number_of_write_operations_per_second": {"readonly": True}, + "confidence_rating_in_percentage": {"readonly": True}, + "sizing_criterion": {"readonly": True}, + "created_timestamp": {"readonly": True}, + "updated_timestamp": {"readonly": True}, + } + + _attribute_map = { + "recommended_azure_sql_target_type": {"key": "recommendedAzureSqlTargetType", "type": "str"}, + "recommended_suitability": {"key": "recommendedSuitability", "type": "str"}, + "buffer_cache_size_in_mb": {"key": "bufferCacheSizeInMB", "type": "float"}, + "product_support_status": {"key": "productSupportStatus", "type": "ProductSupportStatus"}, + "azure_sql_mi_suitability_details": { + "key": "azureSqlMISuitabilityDetails", + "type": "SqlAssessmentV2PaasSuitabilityData", + }, + "azure_sql_db_suitability_details": { + "key": "azureSqlDBSuitabilityDetails", + "type": "SqlAssessmentV2PaasSuitabilityData", + }, + "is_database_highly_available": {"key": "isDatabaseHighlyAvailable", "type": "bool"}, + "linked_availability_group_overview": { + "key": "linkedAvailabilityGroupOverview", + "type": "SqlAvailabilityGroupDataOverview", + }, + "machine_arm_id": {"key": "machineArmId", "type": "str"}, + "assessed_sql_instance_arm_id": {"key": "assessedSqlInstanceArmId", "type": "str"}, + "machine_name": {"key": "machineName", "type": "str"}, + "instance_name": {"key": "instanceName", "type": "str"}, + "database_name": {"key": "databaseName", "type": "str"}, + "database_size_in_mb": {"key": "databaseSizeInMB", "type": "float"}, + "compatibility_level": {"key": "compatibilityLevel", "type": "str"}, + "sql_database_sds_arm_id": {"key": "sqlDatabaseSdsArmId", "type": "str"}, + "percentage_cores_utilization": {"key": "percentageCoresUtilization", "type": "float"}, + "megabytes_per_second_of_read": {"key": "megabytesPerSecondOfRead", "type": "float"}, + "megabytes_per_second_of_write": {"key": "megabytesPerSecondOfWrite", "type": "float"}, + "number_of_read_operations_per_second": {"key": "numberOfReadOperationsPerSecond", "type": "float"}, + "number_of_write_operations_per_second": {"key": "numberOfWriteOperationsPerSecond", "type": "float"}, + "confidence_rating_in_percentage": {"key": "confidenceRatingInPercentage", "type": "float"}, + "sizing_criterion": {"key": "sizingCriterion", "type": "str"}, + "created_timestamp": {"key": "createdTimestamp", "type": "iso-8601"}, + "updated_timestamp": {"key": "updatedTimestamp", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: # pylint: disable=too-many-locals + """ """ + super().__init__(**kwargs) + self.recommended_azure_sql_target_type = None + self.recommended_suitability = None + self.buffer_cache_size_in_mb = None + self.product_support_status = None + self.azure_sql_mi_suitability_details = None + self.azure_sql_db_suitability_details = None + self.is_database_highly_available = None + self.linked_availability_group_overview = None + self.machine_arm_id = None + self.assessed_sql_instance_arm_id = None + self.machine_name = None + self.instance_name = None + self.database_name = None + self.database_size_in_mb = None + self.compatibility_level = None + self.sql_database_sds_arm_id = None + self.percentage_cores_utilization = None + self.megabytes_per_second_of_read = None + self.megabytes_per_second_of_write = None + self.number_of_read_operations_per_second = None + self.number_of_write_operations_per_second = None + self.confidence_rating_in_percentage = None + self.sizing_criterion = None + self.created_timestamp = None + self.updated_timestamp = None + + +class AssessedSqlInstanceDatabaseSummary(_serialization.Model): + """Assessed Sql Instance Database Summary. + + :ivar number_of_user_databases: Gets the number of user databases. + :vartype number_of_user_databases: int + :ivar total_database_size_in_mb: Gets the total database size in MB. + :vartype total_database_size_in_mb: float + :ivar largest_database_size_in_mb: Gets the largest database size in MB. + :vartype largest_database_size_in_mb: float + :ivar total_discovered_user_databases: Gets the total discovered user databases. + :vartype total_discovered_user_databases: int + """ + + _attribute_map = { + "number_of_user_databases": {"key": "numberOfUserDatabases", "type": "int"}, + "total_database_size_in_mb": {"key": "totalDatabaseSizeInMB", "type": "float"}, + "largest_database_size_in_mb": {"key": "largestDatabaseSizeInMB", "type": "float"}, + "total_discovered_user_databases": {"key": "totalDiscoveredUserDatabases", "type": "int"}, + } + + def __init__( + self, + *, + number_of_user_databases: Optional[int] = None, + total_database_size_in_mb: Optional[float] = None, + largest_database_size_in_mb: Optional[float] = None, + total_discovered_user_databases: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword number_of_user_databases: Gets the number of user databases. + :paramtype number_of_user_databases: int + :keyword total_database_size_in_mb: Gets the total database size in MB. + :paramtype total_database_size_in_mb: float + :keyword largest_database_size_in_mb: Gets the largest database size in MB. + :paramtype largest_database_size_in_mb: float + :keyword total_discovered_user_databases: Gets the total discovered user databases. + :paramtype total_discovered_user_databases: int + """ + super().__init__(**kwargs) + self.number_of_user_databases = number_of_user_databases + self.total_database_size_in_mb = total_database_size_in_mb + self.largest_database_size_in_mb = largest_database_size_in_mb + self.total_discovered_user_databases = total_discovered_user_databases + + +class AssessedSqlInstanceDiskDetails(_serialization.Model): + """Assessed Sql Instance Disk Details. + + :ivar disk_id: Gets the disk id. + :vartype disk_id: str + :ivar disk_size_in_mb: Gets the disk size in mb. + :vartype disk_size_in_mb: float + :ivar megabytes_per_second_of_read: Gets the megabytes per second of read. + :vartype megabytes_per_second_of_read: float + :ivar megabytes_per_second_of_write: Gets the megabytes per second of write. + :vartype megabytes_per_second_of_write: float + :ivar number_of_read_operations_per_second: Gets the number of read operations per second. + :vartype number_of_read_operations_per_second: float + :ivar number_of_write_operations_per_second: Gets the number of write operations per second. + :vartype number_of_write_operations_per_second: float + """ + + _attribute_map = { + "disk_id": {"key": "diskId", "type": "str"}, + "disk_size_in_mb": {"key": "diskSizeInMB", "type": "float"}, + "megabytes_per_second_of_read": {"key": "megabytesPerSecondOfRead", "type": "float"}, + "megabytes_per_second_of_write": {"key": "megabytesPerSecondOfWrite", "type": "float"}, + "number_of_read_operations_per_second": {"key": "numberOfReadOperationsPerSecond", "type": "float"}, + "number_of_write_operations_per_second": {"key": "numberOfWriteOperationsPerSecond", "type": "float"}, + } + + def __init__( + self, + *, + disk_id: Optional[str] = None, + disk_size_in_mb: Optional[float] = None, + megabytes_per_second_of_read: Optional[float] = None, + megabytes_per_second_of_write: Optional[float] = None, + number_of_read_operations_per_second: Optional[float] = None, + number_of_write_operations_per_second: Optional[float] = None, + **kwargs: Any + ) -> None: + """ + :keyword disk_id: Gets the disk id. + :paramtype disk_id: str + :keyword disk_size_in_mb: Gets the disk size in mb. + :paramtype disk_size_in_mb: float + :keyword megabytes_per_second_of_read: Gets the megabytes per second of read. + :paramtype megabytes_per_second_of_read: float + :keyword megabytes_per_second_of_write: Gets the megabytes per second of write. + :paramtype megabytes_per_second_of_write: float + :keyword number_of_read_operations_per_second: Gets the number of read operations per second. + :paramtype number_of_read_operations_per_second: float + :keyword number_of_write_operations_per_second: Gets the number of write operations per second. + :paramtype number_of_write_operations_per_second: float + """ + super().__init__(**kwargs) + self.disk_id = disk_id + self.disk_size_in_mb = disk_size_in_mb + self.megabytes_per_second_of_read = megabytes_per_second_of_read + self.megabytes_per_second_of_write = megabytes_per_second_of_write + self.number_of_read_operations_per_second = number_of_read_operations_per_second + self.number_of_write_operations_per_second = number_of_write_operations_per_second + + +class AssessedSqlInstanceStorageDetails(_serialization.Model): + """Assessed Sql Instance Storage Details. + + :ivar storage_type: Gets the storage type. + :vartype storage_type: str + :ivar disk_size_in_mb: Gets the disk size in mb. + :vartype disk_size_in_mb: float + :ivar megabytes_per_second_of_read: Gets the megabytes per second of read. + :vartype megabytes_per_second_of_read: float + :ivar megabytes_per_second_of_write: Gets the megabytes per second of read. + :vartype megabytes_per_second_of_write: float + :ivar number_of_read_operations_per_second: Gets the number of read operations per second. + :vartype number_of_read_operations_per_second: float + :ivar number_of_write_operations_per_second: Gets the number of write operations per second. + :vartype number_of_write_operations_per_second: float + """ + + _attribute_map = { + "storage_type": {"key": "storageType", "type": "str"}, + "disk_size_in_mb": {"key": "diskSizeInMB", "type": "float"}, + "megabytes_per_second_of_read": {"key": "megabytesPerSecondOfRead", "type": "float"}, + "megabytes_per_second_of_write": {"key": "megabytesPerSecondOfWrite", "type": "float"}, + "number_of_read_operations_per_second": {"key": "numberOfReadOperationsPerSecond", "type": "float"}, + "number_of_write_operations_per_second": {"key": "numberOfWriteOperationsPerSecond", "type": "float"}, + } + + def __init__( + self, + *, + storage_type: Optional[str] = None, + disk_size_in_mb: Optional[float] = None, + megabytes_per_second_of_read: Optional[float] = None, + megabytes_per_second_of_write: Optional[float] = None, + number_of_read_operations_per_second: Optional[float] = None, + number_of_write_operations_per_second: Optional[float] = None, + **kwargs: Any + ) -> None: + """ + :keyword storage_type: Gets the storage type. + :paramtype storage_type: str + :keyword disk_size_in_mb: Gets the disk size in mb. + :paramtype disk_size_in_mb: float + :keyword megabytes_per_second_of_read: Gets the megabytes per second of read. + :paramtype megabytes_per_second_of_read: float + :keyword megabytes_per_second_of_write: Gets the megabytes per second of read. + :paramtype megabytes_per_second_of_write: float + :keyword number_of_read_operations_per_second: Gets the number of read operations per second. + :paramtype number_of_read_operations_per_second: float + :keyword number_of_write_operations_per_second: Gets the number of write operations per second. + :paramtype number_of_write_operations_per_second: float + """ + super().__init__(**kwargs) + self.storage_type = storage_type + self.disk_size_in_mb = disk_size_in_mb + self.megabytes_per_second_of_read = megabytes_per_second_of_read + self.megabytes_per_second_of_write = megabytes_per_second_of_write + self.number_of_read_operations_per_second = number_of_read_operations_per_second + self.number_of_write_operations_per_second = number_of_write_operations_per_second + + +class AssessedSqlInstanceSummary(_serialization.Model): + """Assessed Sql Instance Summary. + + :ivar instance_id: Gets the instance id. + :vartype instance_id: str + :ivar instance_name: Gets the instance name. + :vartype instance_name: str + :ivar sql_instance_sds_arm_id: Gets the instance arm id. + :vartype sql_instance_sds_arm_id: str + :ivar sql_instance_entity_id: Gets the instance entity id. + :vartype sql_instance_entity_id: str + :ivar sql_edition: Gets the Sql edition. + :vartype sql_edition: str + :ivar sql_version: Gets the Sql version. + :vartype sql_version: str + :ivar is_clustered: Gets whether Sql is clustered. + :vartype is_clustered: bool + :ivar is_high_availability_enabled: Gets whether Sql is highly available. + :vartype is_high_availability_enabled: bool + :ivar sql_fci_state: Gets the Sql Fci state. Known values are: "Unknown", "Active", "Passive", + and "NotApplicable". + :vartype sql_fci_state: str or ~azure.mgmt.migrationassessment.models.SqlFCIState + """ + + _attribute_map = { + "instance_id": {"key": "instanceId", "type": "str"}, + "instance_name": {"key": "instanceName", "type": "str"}, + "sql_instance_sds_arm_id": {"key": "sqlInstanceSdsArmId", "type": "str"}, + "sql_instance_entity_id": {"key": "sqlInstanceEntityId", "type": "str"}, + "sql_edition": {"key": "sqlEdition", "type": "str"}, + "sql_version": {"key": "sqlVersion", "type": "str"}, + "is_clustered": {"key": "isClustered", "type": "bool"}, + "is_high_availability_enabled": {"key": "isHighAvailabilityEnabled", "type": "bool"}, + "sql_fci_state": {"key": "sqlFciState", "type": "str"}, + } + + def __init__( + self, + *, + instance_id: Optional[str] = None, + instance_name: Optional[str] = None, + sql_instance_sds_arm_id: Optional[str] = None, + sql_instance_entity_id: Optional[str] = None, + sql_edition: Optional[str] = None, + sql_version: Optional[str] = None, + is_clustered: Optional[bool] = None, + is_high_availability_enabled: Optional[bool] = None, + sql_fci_state: Optional[Union[str, "_models.SqlFCIState"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword instance_id: Gets the instance id. + :paramtype instance_id: str + :keyword instance_name: Gets the instance name. + :paramtype instance_name: str + :keyword sql_instance_sds_arm_id: Gets the instance arm id. + :paramtype sql_instance_sds_arm_id: str + :keyword sql_instance_entity_id: Gets the instance entity id. + :paramtype sql_instance_entity_id: str + :keyword sql_edition: Gets the Sql edition. + :paramtype sql_edition: str + :keyword sql_version: Gets the Sql version. + :paramtype sql_version: str + :keyword is_clustered: Gets whether Sql is clustered. + :paramtype is_clustered: bool + :keyword is_high_availability_enabled: Gets whether Sql is highly available. + :paramtype is_high_availability_enabled: bool + :keyword sql_fci_state: Gets the Sql Fci state. Known values are: "Unknown", "Active", + "Passive", and "NotApplicable". + :paramtype sql_fci_state: str or ~azure.mgmt.migrationassessment.models.SqlFCIState + """ + super().__init__(**kwargs) + self.instance_id = instance_id + self.instance_name = instance_name + self.sql_instance_sds_arm_id = sql_instance_sds_arm_id + self.sql_instance_entity_id = sql_instance_entity_id + self.sql_edition = sql_edition + self.sql_version = sql_version + self.is_clustered = is_clustered + self.is_high_availability_enabled = is_high_availability_enabled + self.sql_fci_state = sql_fci_state + + +class AssessedSqlInstanceV2(ProxyResource): + """Assessed SQL instance web model class. + + 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.AssessedSqlInstanceV2Properties + """ + + _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": "AssessedSqlInstanceV2Properties"}, + } + + def __init__( + self, *, properties: Optional["_models.AssessedSqlInstanceV2Properties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.AssessedSqlInstanceV2Properties + """ + super().__init__(**kwargs) + self.properties = properties + + +class AssessedSqlInstanceV2ListResult(_serialization.Model): + """The response of a AssessedSqlInstanceV2 list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The AssessedSqlInstanceV2 items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.AssessedSqlInstanceV2] + :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": "[AssessedSqlInstanceV2]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.AssessedSqlInstanceV2"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The AssessedSqlInstanceV2 items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.AssessedSqlInstanceV2] + :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 AssessedSqlInstanceV2Properties(_serialization.Model): + """Assessed SQL instance properties web model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar memory_in_use_in_mb: Gets or sets the memory used by SQL instance in megabytes. + :vartype memory_in_use_in_mb: float + :ivar has_scan_occurred: Gets or sets a value indicating whether SQL instance has been deep + discovered. + :vartype has_scan_occurred: bool + :ivar recommended_azure_sql_target_type: Gets or sets the recommended azure SQL target type. + Known values are: "Unknown", "Recommended", "AzureSqlDatabase", "AzureSqlManagedInstance", + "AzureSqlVirtualMachine", and "AzureVirtualMachine". + :vartype recommended_azure_sql_target_type: str or + ~azure.mgmt.migrationassessment.models.TargetType + :ivar recommended_suitability: Gets or sets the recommended azure SQL suitability. Known values + are: "Unknown", "SuitableForSqlDB", "SuitableForSqlMI", "SuitableForVM", + "PotentiallySuitableForVM", "ReadinessUnknown", "NotSuitable", "SuitableForSqlVM", + "ConditionallySuitableForSqlDB", "ConditionallySuitableForSqlMI", "ConditionallySuitableForVM", + and "ConditionallySuitableForSqlVM". + :vartype recommended_suitability: str or + ~azure.mgmt.migrationassessment.models.RecommendedSuitability + :ivar azure_sql_mi_suitability_details: SQL instance azure SQL MI suitability details. + :vartype azure_sql_mi_suitability_details: + ~azure.mgmt.migrationassessment.models.SqlAssessmentV2PaasSuitabilityData + :ivar azure_sql_db_suitability_details: SQL instance azure SQL DB suitability details. + :vartype azure_sql_db_suitability_details: + ~azure.mgmt.migrationassessment.models.SqlAssessmentV2PaasSuitabilityData + :ivar azure_sql_vm_suitability_details: SQL instance azure SQL VM suitability details. + :vartype azure_sql_vm_suitability_details: + ~azure.mgmt.migrationassessment.models.SqlAssessmentV2IaasSuitabilityData + :ivar storage_type_based_details: Gets the storage details. + :vartype storage_type_based_details: + list[~azure.mgmt.migrationassessment.models.AssessedSqlInstanceStorageDetails] + :ivar product_support_status: Gets the product support status related details. + :vartype product_support_status: ~azure.mgmt.migrationassessment.models.ProductSupportStatus + :ivar fci_metadata: Gets the FCI metadata if this instance represents an FCI instance. + :vartype fci_metadata: ~azure.mgmt.migrationassessment.models.SqlFCIMetadata + :ivar availability_replica_summary: Gets the overview counts of availability replicas in the + assessed instance, by + commit mode and read type. + :vartype availability_replica_summary: + ~azure.mgmt.migrationassessment.models.SqlAvailabilityReplicaSummary + :ivar is_clustered: Gets a value indicating whether the SQL instance is clustered or not. + :vartype is_clustered: bool + :ivar is_high_availability_enabled: Gets a value indicating whether the high availability is + enabled or not. + :vartype is_high_availability_enabled: bool + :ivar recommended_target_reasonings: Gets the list of recommended target reasoning. + :vartype recommended_target_reasonings: + list[~azure.mgmt.migrationassessment.models.SqlRecommendationReasoning] + :ivar machine_arm_id: Machine arm id. + :vartype machine_arm_id: str + :ivar machine_name: Machine display name. + :vartype machine_name: str + :ivar instance_name: SQL instance name. + :vartype instance_name: str + :ivar sql_instance_sds_arm_id: SQL instance SDS arm id. + :vartype sql_instance_sds_arm_id: str + :ivar sql_edition: SQL instance edition. + :vartype sql_edition: str + :ivar sql_version: SQL instance version. + :vartype sql_version: str + :ivar number_of_cores_allocated: Number of CPU cores assigned to the SQL instance. + :vartype number_of_cores_allocated: int + :ivar percentage_cores_utilization: The percentage of the total number of cores being utilized + by the SQL instance. + :vartype percentage_cores_utilization: float + :ivar logical_disks: The logical disk details. + :vartype logical_disks: + list[~azure.mgmt.migrationassessment.models.AssessedSqlInstanceDiskDetails] + :ivar database_summary: The databases summary. + :vartype database_summary: + ~azure.mgmt.migrationassessment.models.AssessedSqlInstanceDatabaseSummary + :ivar confidence_rating_in_percentage: Confidence Rating in Percentage. + :vartype confidence_rating_in_percentage: float + :ivar sizing_criterion: Assessment sizing criterion. Known values are: "PerformanceBased" and + "AsOnPremises". + :vartype sizing_criterion: str or + ~azure.mgmt.migrationassessment.models.AssessmentSizingCriterion + :ivar created_timestamp: When was assessed SQL instance first created. + :vartype created_timestamp: ~datetime.datetime + :ivar updated_timestamp: When was assessed SQL instance last updated. + :vartype updated_timestamp: ~datetime.datetime + """ + + _validation = { + "memory_in_use_in_mb": {"readonly": True}, + "has_scan_occurred": {"readonly": True}, + "recommended_azure_sql_target_type": {"readonly": True}, + "recommended_suitability": {"readonly": True}, + "azure_sql_mi_suitability_details": {"readonly": True}, + "azure_sql_db_suitability_details": {"readonly": True}, + "azure_sql_vm_suitability_details": {"readonly": True}, + "storage_type_based_details": {"readonly": True}, + "product_support_status": {"readonly": True}, + "fci_metadata": {"readonly": True}, + "availability_replica_summary": {"readonly": True}, + "is_clustered": {"readonly": True}, + "is_high_availability_enabled": {"readonly": True}, + "recommended_target_reasonings": {"readonly": True}, + "machine_arm_id": {"readonly": True}, + "machine_name": {"readonly": True}, + "instance_name": {"readonly": True}, + "sql_instance_sds_arm_id": {"readonly": True}, + "sql_edition": {"readonly": True}, + "sql_version": {"readonly": True}, + "number_of_cores_allocated": {"readonly": True}, + "percentage_cores_utilization": {"readonly": True}, + "logical_disks": {"readonly": True}, + "database_summary": {"readonly": True}, + "confidence_rating_in_percentage": {"readonly": True}, + "sizing_criterion": {"readonly": True}, + "created_timestamp": {"readonly": True}, + "updated_timestamp": {"readonly": True}, + } + + _attribute_map = { + "memory_in_use_in_mb": {"key": "memoryInUseInMB", "type": "float"}, + "has_scan_occurred": {"key": "hasScanOccurred", "type": "bool"}, + "recommended_azure_sql_target_type": {"key": "recommendedAzureSqlTargetType", "type": "str"}, + "recommended_suitability": {"key": "recommendedSuitability", "type": "str"}, + "azure_sql_mi_suitability_details": { + "key": "azureSqlMISuitabilityDetails", + "type": "SqlAssessmentV2PaasSuitabilityData", + }, + "azure_sql_db_suitability_details": { + "key": "azureSqlDBSuitabilityDetails", + "type": "SqlAssessmentV2PaasSuitabilityData", + }, + "azure_sql_vm_suitability_details": { + "key": "azureSqlVMSuitabilityDetails", + "type": "SqlAssessmentV2IaasSuitabilityData", + }, + "storage_type_based_details": {"key": "storageTypeBasedDetails", "type": "[AssessedSqlInstanceStorageDetails]"}, + "product_support_status": {"key": "productSupportStatus", "type": "ProductSupportStatus"}, + "fci_metadata": {"key": "fciMetadata", "type": "SqlFCIMetadata"}, + "availability_replica_summary": {"key": "availabilityReplicaSummary", "type": "SqlAvailabilityReplicaSummary"}, + "is_clustered": {"key": "isClustered", "type": "bool"}, + "is_high_availability_enabled": {"key": "isHighAvailabilityEnabled", "type": "bool"}, + "recommended_target_reasonings": {"key": "recommendedTargetReasonings", "type": "[SqlRecommendationReasoning]"}, + "machine_arm_id": {"key": "machineArmId", "type": "str"}, + "machine_name": {"key": "machineName", "type": "str"}, + "instance_name": {"key": "instanceName", "type": "str"}, + "sql_instance_sds_arm_id": {"key": "sqlInstanceSdsArmId", "type": "str"}, + "sql_edition": {"key": "sqlEdition", "type": "str"}, + "sql_version": {"key": "sqlVersion", "type": "str"}, + "number_of_cores_allocated": {"key": "numberOfCoresAllocated", "type": "int"}, + "percentage_cores_utilization": {"key": "percentageCoresUtilization", "type": "float"}, + "logical_disks": {"key": "logicalDisks", "type": "[AssessedSqlInstanceDiskDetails]"}, + "database_summary": {"key": "databaseSummary", "type": "AssessedSqlInstanceDatabaseSummary"}, + "confidence_rating_in_percentage": {"key": "confidenceRatingInPercentage", "type": "float"}, + "sizing_criterion": {"key": "sizingCriterion", "type": "str"}, + "created_timestamp": {"key": "createdTimestamp", "type": "iso-8601"}, + "updated_timestamp": {"key": "updatedTimestamp", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: # pylint: disable=too-many-locals + """ """ + super().__init__(**kwargs) + self.memory_in_use_in_mb = None + self.has_scan_occurred = None + self.recommended_azure_sql_target_type = None + self.recommended_suitability = None + self.azure_sql_mi_suitability_details = None + self.azure_sql_db_suitability_details = None + self.azure_sql_vm_suitability_details = None + self.storage_type_based_details = None + self.product_support_status = None + self.fci_metadata = None + self.availability_replica_summary = None + self.is_clustered = None + self.is_high_availability_enabled = None + self.recommended_target_reasonings = None + self.machine_arm_id = None + self.machine_name = None + self.instance_name = None + self.sql_instance_sds_arm_id = None + self.sql_edition = None + self.sql_version = None + self.number_of_cores_allocated = None + self.percentage_cores_utilization = None + self.logical_disks = None + self.database_summary = None + self.confidence_rating_in_percentage = None + self.sizing_criterion = None + self.created_timestamp = None + self.updated_timestamp = None + + +class AssessedSqlMachine(ProxyResource): + """SQL Assessment REST 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.AssessedSqlMachineProperties + """ + + _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": "AssessedSqlMachineProperties"}, + } + + def __init__(self, *, properties: Optional["_models.AssessedSqlMachineProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.AssessedSqlMachineProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class AssessedSqlMachineListResult(_serialization.Model): + """The response of a AssessedSqlMachine list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The AssessedSqlMachine items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.AssessedSqlMachine] + :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": "[AssessedSqlMachine]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.AssessedSqlMachine"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The AssessedSqlMachine items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.AssessedSqlMachine] + :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 AssessedSqlMachineProperties(_serialization.Model): + """Assessed SQL machine properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar bios_guid: Gets or sets the BIOS GUID for the machine. + :vartype bios_guid: str + :ivar fqdn: Gets or sets the FQDN for the machine. + :vartype fqdn: str + :ivar sql_instances: Gets the list of SQL instances discovered on the machine. + :vartype sql_instances: list[~azure.mgmt.migrationassessment.models.AssessedSqlInstanceSummary] + :ivar suitability_detail: Gets or sets the detailed messages that were set on the machine + during + evaluation. Known values are: "None", "RecommendedSizeHasLessNetworkAdapters", + "CannotReportComputeCost", "CannotReportStorageCost", "CannotReportBandwidthCosts", + "PercentageOfCoresUtilizedMissing", "PercentageOfMemoryUtilizedMissing", + "PercentageOfCoresUtilizedOutOfRange", and "PercentageOfMemoryUtilizedOutOfRange". + :vartype suitability_detail: str or + ~azure.mgmt.migrationassessment.models.AzureVmSuitabilityDetail + :ivar suitability_explanation: Gets or sets the explanation if machine is not suitable for + cloud. Known values are: "Unknown", "NotApplicable", + "GuestOperatingSystemArchitectureNotSupported", "GuestOperatingSystemNotSupported", + "BootTypeNotSupported", "MoreDisksThanSupported", "NoSuitableVmSizeFound", + "OneOrMoreDisksNotSuitable", "OneOrMoreAdaptersNotSuitable", + "InternalErrorOccurredDuringComputeEvaluation", "InternalErrorOccurredDuringStorageEvaluation", + "InternalErrorOccurredDuringNetworkEvaluation", "NoVmSizeSupportsStoragePerformance", + "NoVmSizeSupportsNetworkPerformance", "NoVmSizeForSelectedPricingTier", + "NoVmSizeForSelectedAzureLocation", "CheckRedHatLinuxVersion", "CheckOpenSuseLinuxVersion", + "CheckWindowsServer2008R2Version", "CheckCentOsVersion", "CheckDebianLinuxVersion", + "CheckSuseLinuxVersion", "CheckOracleLinuxVersion", "CheckUbuntuLinuxVersion", + "CheckCoreOsLinuxVersion", "WindowsServerVersionConditionallySupported", + "NoGuestOperatingSystemConditionallySupported", "WindowsClientVersionsConditionallySupported", + "BootTypeUnknown", "GuestOperatingSystemUnknown", "WindowsServerVersionsSupportedWithCaveat", + "WindowsOSNoLongerUnderMSSupport", "EndorsedWithConditionsLinuxDistributions", + "UnendorsedLinuxDistributions", "NoVmSizeForStandardPricingTier", + "NoVmSizeForBasicPricingTier", "NoVmSizeInSelectedFamilyFound", "NoEaPriceFoundForVmSize", and + "NoVmSizeFoundForOfferCurrencyReservedInstance". + :vartype suitability_explanation: str or + ~azure.mgmt.migrationassessment.models.AzureVmSuitabilityExplanation + :ivar recommended_vm_size: Gets or sets the Recommended Azure Size for the machine. Known + values are: "Unknown", "Basic_A0", "Basic_A1", "Basic_A2", "Basic_A3", "Basic_A4", + "Standard_A0", "Standard_A1", "Standard_A2", "Standard_A3", "Standard_A4", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A9", "Standard_A10", "Standard_A11", + "Standard_A1_v2", "Standard_A2_v2", "Standard_A4_v2", "Standard_A8_v2", "Standard_A2m_v2", + "Standard_A4m_v2", "Standard_A8m_v2", "Standard_D1", "Standard_D2", "Standard_D3", + "Standard_D4", "Standard_D11", "Standard_D12", "Standard_D13", "Standard_D14", + "Standard_D1_v2", "Standard_D2_v2", "Standard_D3_v2", "Standard_D4_v2", "Standard_D5_v2", + "Standard_D11_v2", "Standard_D12_v2", "Standard_D13_v2", "Standard_D14_v2", "Standard_D15_v2", + "Standard_DS1", "Standard_DS2", "Standard_DS3", "Standard_DS4", "Standard_DS11", + "Standard_DS12", "Standard_DS13", "Standard_DS14", "Standard_DS1_v2", "Standard_DS2_v2", + "Standard_DS3_v2", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_DS11_v2", + "Standard_DS12_v2", "Standard_DS13_v2", "Standard_DS14_v2", "Standard_DS15_v2", "Standard_F1", + "Standard_F2", "Standard_F4", "Standard_F8", "Standard_F16", "Standard_F1s", "Standard_F2s", + "Standard_F4s", "Standard_F8s", "Standard_F16s", "Standard_G1", "Standard_G2", "Standard_G3", + "Standard_G4", "Standard_G5", "Standard_GS1", "Standard_GS2", "Standard_GS3", "Standard_GS4", + "Standard_GS5", "Standard_H8", "Standard_H16", "Standard_H8m", "Standard_H16m", + "Standard_H16r", "Standard_H16mr", "Standard_L4s", "Standard_L8s", "Standard_L16s", + "Standard_L32s", "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", + "Standard_D32s_v3", "Standard_D64s_v3", "Standard_D2_v3", "Standard_D4_v3", "Standard_D8_v3", + "Standard_D16_v3", "Standard_D32_v3", "Standard_D64_v3", "Standard_F2s_v2", "Standard_F4s_v2", + "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", + "Standard_F72s_v2", "Standard_E2_v3", "Standard_E4_v3", "Standard_E8_v3", "Standard_E16_v3", + "Standard_E32_v3", "Standard_E64_v3", "Standard_E2s_v3", "Standard_E4s_v3", "Standard_E8s_v3", + "Standard_E16s_v3", "Standard_E32s_v3", "Standard_E64s_v3", "Standard_M64s", "Standard_M64ms", + "Standard_M128s", "Standard_M128ms", "Standard_DC2s", "Standard_DC4s", "Standard_E20_v3", + "Standard_E20s_v3", "Standard_E64i_v3", "Standard_E64is_v3", "Standard_M8ms", "Standard_M16ms", + "Standard_M32ls", "Standard_M32ms", "Standard_M32ts", "Standard_M64", "Standard_M64ls", + "Standard_M64m", "Standard_M128", "Standard_M128m", "Standard_L8s_v2", "Standard_L16s_v2", + "Standard_L32s_v2", "Standard_L48s_v2", "Standard_L64s_v2", "Standard_L80s_v2", + "Standard_D2_v4", "Standard_D4_v4", "Standard_D8_v4", "Standard_D16_v4", "Standard_D32_v4", + "Standard_D48_v4", "Standard_D64_v4", "Standard_D2s_v4", "Standard_D4s_v4", "Standard_D8s_v4", + "Standard_D16s_v4", "Standard_D32s_v4", "Standard_D48s_v4", "Standard_D64s_v4", + "Standard_D2d_v4", "Standard_D4d_v4", "Standard_D8d_v4", "Standard_D16d_v4", + "Standard_D32d_v4", "Standard_D48d_v4", "Standard_D64d_v4", "Standard_D2ds_v4", + "Standard_D4ds_v4", "Standard_D8ds_v4", "Standard_D16ds_v4", "Standard_D32ds_v4", + "Standard_D48ds_v4", "Standard_D64ds_v4", "Standard_E2_v4", "Standard_E4_v4", "Standard_E8_v4", + "Standard_E16_v4", "Standard_E20_v4", "Standard_E32_v4", "Standard_E48_v4", "Standard_E64_v4", + "Standard_E2s_v4", "Standard_E4s_v4", "Standard_E8s_v4", "Standard_E16s_v4", + "Standard_E20s_v4", "Standard_E32s_v4", "Standard_E48s_v4", "Standard_E64s_v4", + "Standard_E2d_v4", "Standard_E4d_v4", "Standard_E8d_v4", "Standard_E16d_v4", + "Standard_E20d_v4", "Standard_E32d_v4", "Standard_E48d_v4", "Standard_E64d_v4", + "Standard_E2ds_v4", "Standard_E4ds_v4", "Standard_E8ds_v4", "Standard_E16ds_v4", + "Standard_E20ds_v4", "Standard_E32ds_v4", "Standard_E48ds_v4", "Standard_E64ds_v4", + "Standard_E2as_v4", "Standard_E4as_v4", "Standard_E8as_v4", "Standard_E16as_v4", + "Standard_E20as_v4", "Standard_E32as_v4", "Standard_E48as_v4", "Standard_E64as_v4", + "Standard_E96as_v4", "Standard_D2as_v4", "Standard_D4as_v4", "Standard_D8as_v4", + "Standard_D16as_v4", "Standard_D32as_v4", "Standard_D48as_v4", "Standard_D64as_v4", + "Standard_D96as_v4", "Standard_M208ms_v2", "Standard_M208s_v2", "Standard_M416ms_v2", + "Standard_M416s_v2", "Standard_F48s_v2", "Standard_E48_v3", "Standard_E48s_v3", + "Standard_E80is_v4", "Standard_E80ids_v4", "Standard_E2a_v4", "Standard_E4a_v4", + "Standard_E8a_v4", "Standard_E16a_v4", "Standard_E20a_v4", "Standard_E32a_v4", + "Standard_E48a_v4", "Standard_E64a_v4", "Standard_E96a_v4", "Standard_D2a_v4", + "Standard_D4a_v4", "Standard_D8a_v4", "Standard_D16a_v4", "Standard_D32a_v4", + "Standard_D48a_v4", "Standard_D64a_v4", "Standard_D96a_v4", "Standard_M32ms_v2", + "Standard_M64s_v2", "Standard_M64ms_v2", "Standard_M128s_v2", "Standard_M128ms_v2", + "Standard_M192is_v2", "Standard_M192ims_v2", "Standard_M32dms_v2", "Standard_M64ds_v2", + "Standard_M64dms_v2", "Standard_M128ds_v2", "Standard_M128dms_v2", "Standard_M192ids_v2", + "Standard_M192idms_v2", "Standard_D2_v5", "Standard_D4_v5", "Standard_D8_v5", + "Standard_D16_v5", "Standard_D32_v5", "Standard_D48_v5", "Standard_D64_v5", "Standard_D96_v5", + "Standard_D2s_v5", "Standard_D4s_v5", "Standard_D8s_v5", "Standard_D16s_v5", + "Standard_D32s_v5", "Standard_D48s_v5", "Standard_D64s_v5", "Standard_D96s_v5", + "Standard_D2d_v5", "Standard_D4d_v5", "Standard_D8d_v5", "Standard_D16d_v5", + "Standard_D32d_v5", "Standard_D48d_v5", "Standard_D64d_v5", "Standard_D96d_v5", + "Standard_D2ds_v5", "Standard_D4ds_v5", "Standard_D8ds_v5", "Standard_D16ds_v5", + "Standard_D32ds_v5", "Standard_D48ds_v5", "Standard_D64ds_v5", "Standard_D96ds_v5", + "Standard_D2as_v5", "Standard_D4as_v5", "Standard_D8as_v5", "Standard_D16as_v5", + "Standard_D32as_v5", "Standard_D48as_v5", "Standard_D64as_v5", "Standard_D96as_v5", + "Standard_D2ads_v5", "Standard_D4ads_v5", "Standard_D8ads_v5", "Standard_D16ads_v5", + "Standard_D32ads_v5", "Standard_D48ads_v5", "Standard_D64ads_v5", "Standard_D96ads_v5", + "Standard_E2_v5", "Standard_E4_v5", "Standard_E8_v5", "Standard_E16_v5", "Standard_E20_v5", + "Standard_E32_v5", "Standard_E48_v5", "Standard_E64_v5", "Standard_E96_v5", + "Standard_E104i_v5", "Standard_E2s_v5", "Standard_E4s_v5", "Standard_E8s_v5", + "Standard_E16s_v5", "Standard_E20s_v5", "Standard_E32s_v5", "Standard_E48s_v5", + "Standard_E64s_v5", "Standard_E96s_v5", "Standard_E104is_v5", "Standard_E2d_v5", + "Standard_E4d_v5", "Standard_E8d_v5", "Standard_E16d_v5", "Standard_E20d_v5", + "Standard_E32d_v5", "Standard_E48d_v5", "Standard_E64d_v5", "Standard_E96d_v5", + "Standard_E104id_v5", "Standard_E2ds_v5", "Standard_E4ds_v5", "Standard_E8ds_v5", + "Standard_E16ds_v5", "Standard_E20ds_v5", "Standard_E32ds_v5", "Standard_E48ds_v5", + "Standard_E64ds_v5", "Standard_E96ds_v5", "Standard_E104ids_v5", "Standard_E2as_v5", + "Standard_E4as_v5", "Standard_E8as_v5", "Standard_E16as_v5", "Standard_E20as_v5", + "Standard_E32as_v5", "Standard_E48as_v5", "Standard_E64as_v5", "Standard_E96as_v5", + "Standard_E2ads_v5", "Standard_E4ads_v5", "Standard_E8ads_v5", "Standard_E16ads_v5", + "Standard_E20ads_v5", "Standard_E32ads_v5", "Standard_E48ads_v5", "Standard_E64ads_v5", + "Standard_E96ads_v5", "Standard_M8_2ms", "Standard_M8_4ms", "Standard_M16_4ms", + "Standard_M16_8ms", "Standard_M32_8ms", "Standard_M32_16ms", "Standard_M64_32ms", + "Standard_M64_16ms", "Standard_M128_64ms", "Standard_M128_32ms", "Standard_E4_2s_v3", + "Standard_E8_4s_v3", "Standard_E8_2s_v3", "Standard_E16_8s_v3", "Standard_E16_4s_v3", + "Standard_E32_16s_v3", "Standard_E32_8s_v3", "Standard_E64_32s_v3", "Standard_E64_16s_v3", + "Standard_E4_2s_v4", "Standard_E8_4s_v4", "Standard_E8_2s_v4", "Standard_E16_8s_v4", + "Standard_E16_4s_v4", "Standard_E32_16s_v4", "Standard_E32_8s_v4", "Standard_E64_32s_v4", + "Standard_E64_16s_v4", "Standard_E4_2ds_v4", "Standard_E8_4ds_v4", "Standard_E8_2ds_v4", + "Standard_E16_8ds_v4", "Standard_E16_4ds_v4", "Standard_E32_16ds_v4", "Standard_E32_8ds_v4", + "Standard_E64_32ds_v4", "Standard_E64_16ds_v4", "Standard_E4_2as_v4", "Standard_E8_4as_v4", + "Standard_E8_2as_v4", "Standard_E16_8as_v4", "Standard_E16_4as_v4", "Standard_E32_16as_v4", + "Standard_E32_8as_v4", "Standard_E64_32as_v4", "Standard_E64_16as_v4", "Standard_E96_48as_v4", + "Standard_E96_24as_v4", "Standard_E4_2ads_v5", "Standard_E8_4ads_v5", "Standard_E8_2ads_v5", + "Standard_E16_8ads_v5", "Standard_E16_4ads_v5", "Standard_E32_16ads_v5", + "Standard_E32_8ads_v5", "Standard_E64_32ads_v5", "Standard_E64_16ads_v5", + "Standard_E96_48ads_v5", "Standard_E96_24ads_v5", "Standard_E4_2s_v5", "Standard_E8_4s_v5", + "Standard_E8_2s_v5", "Standard_E16_8s_v5", "Standard_E16_4s_v5", "Standard_E32_16s_v5", + "Standard_E32_8s_v5", "Standard_E64_32s_v5", "Standard_E64_16s_v5", "Standard_E96_48s_v5", + "Standard_E96_24s_v5", "Standard_E4_2ds_v5", "Standard_E8_4ds_v5", "Standard_E8_2ds_v5", + "Standard_E16_8ds_v5", "Standard_E16_4ds_v5", "Standard_E32_16ds_v5", "Standard_E32_8ds_v5", + "Standard_E64_32ds_v5", "Standard_E64_16ds_v5", "Standard_E96_48ds_v5", "Standard_E96_24ds_v5", + "Standard_E4_2as_v5", "Standard_E8_4as_v5", "Standard_E8_2as_v5", "Standard_E16_8as_v5", + "Standard_E16_4as_v5", "Standard_E32_16as_v5", "Standard_E32_8as_v5", "Standard_E64_32as_v5", + "Standard_E64_16as_v5", "Standard_E96_48as_v5", "Standard_E96_24as_v5", "Standard_GS4_8", + "Standard_GS4_4", "Standard_GS5_16", "Standard_GS5_8", "Standard_DS11_1_v2", + "Standard_DS12_2_v2", "Standard_DS12_1_v2", "Standard_DS13_4_v2", "Standard_DS13_2_v2", + "Standard_DS14_8_v2", "Standard_DS14_4_v2", "Standard_M416_208s_v2", "Standard_M416_208ms_v2", + "Standard_E2bs_v5", "Standard_E4bs_v5", "Standard_E8bs_v5", "Standard_E16bs_v5", + "Standard_E32bs_v5", "Standard_E48bs_v5", "Standard_E64bs_v5", "Standard_E2bds_v5", + "Standard_E4bds_v5", "Standard_E8bds_v5", "Standard_E16bds_v5", "Standard_E32bds_v5", + "Standard_E48bds_v5", and "Standard_E64bds_v5". + :vartype recommended_vm_size: str or ~azure.mgmt.migrationassessment.models.AzureVmSize + :ivar recommended_vm_family: Gets or sets the Recommended Azure VM Family for the machine. + Known values are: "Unknown", "Basic_A0_A4", "Standard_A0_A7", "Standard_A8_A11", "Av2_series", + "D_series", "Dv2_series", "DS_series", "DSv2_series", "F_series", "Fs_series", "G_series", + "GS_series", "H_series", "Ls_series", "Dsv3_series", "Dv3_series", "Fsv2_series", "Ev3_series", + "Esv3_series", "M_series", "DC_Series", "Lsv2_series", "Ev4_series", "Esv4_series", + "Edv4_series", "Edsv4_series", "Dv4_series", "Dsv4_series", "Ddv4_series", "Ddsv4_series", + "Easv4_series", "Dasv4_series", "Mv2_series", "Eav4_series", "Dav4_series", "Msv2_series", + "Mdsv2_series", "Dv5_series", "Dsv5_series", "Ddv5_series", "Ddsv5_series", "Dasv5_series", + "Dadsv5_series", "Ev5_series", "Esv5_series", "Edv5_series", "Edsv5_series", "Easv5_series", + "Eadsv5_series", "Ebsv5_series", and "Ebdsv5_series". + :vartype recommended_vm_family: str or ~azure.mgmt.migrationassessment.models.AzureVmFamily + :ivar product_support_status: Gets the product support status related details. + :vartype product_support_status: ~azure.mgmt.migrationassessment.models.ProductSupportStatus + :ivar recommended_vm_size_number_of_cores: Gets or sets the Number of cores for recommended + size. + :vartype recommended_vm_size_number_of_cores: int + :ivar recommended_vm_size_megabytes_of_memory: Gets or sets the Megabytes of memory for + recommended size. + :vartype recommended_vm_size_megabytes_of_memory: float + :ivar monthly_compute_cost: Gets or sets the monthly compute cost calculated for recommended + size. + :vartype monthly_compute_cost: float + :ivar disks: Gets the list of data disks that were assessed as part of this assessment. + :vartype disks: dict[str, ~azure.mgmt.migrationassessment.models.AssessedDiskData] + :ivar network_adapters: Gets the list of network adapters that were assessed as part of this + assessment. + :vartype network_adapters: dict[str, + ~azure.mgmt.migrationassessment.models.SqlAssessedNetworkAdapter] + :ivar monthly_bandwidth_cost: Gets or sets the monthly networking cost. + :vartype monthly_bandwidth_cost: float + :ivar monthly_storage_cost: Gets or sets the monthly total storage cost. + :vartype monthly_storage_cost: float + :ivar cost_components: Gets the collection of cost components. + :vartype cost_components: list[~azure.mgmt.migrationassessment.models.CostComponent] + :ivar security_suitability: Gets the suitability for Microsoft cloud defender. Known values + are: "Unknown", "NotSuitable", "Suitable", "ConditionallySuitable", and "ReadinessUnknown". + :vartype security_suitability: str or ~azure.mgmt.migrationassessment.models.CloudSuitability + :ivar migration_guidelines: Gets the list of migration guidelines applicable. + :vartype migration_guidelines: + list[~azure.mgmt.migrationassessment.models.SqlMigrationGuideline] + :ivar boot_type: Boot type of machine discovered in private data center. Known values are: + "Unknown", "EFI", "BIOS", and "NotSpecified". + :vartype boot_type: str or ~azure.mgmt.migrationassessment.models.MachineBootType + :ivar operating_system_type: Operating system as reported by datacenter management solution. + :vartype operating_system_type: str + :ivar operating_system_name: Operating system as reported by datacenter management solution. + :vartype operating_system_name: str + :ivar operating_system_version: Operating system version as reported by datacenter management + solution. + :vartype operating_system_version: str + :ivar operating_system_architecture: Operating system architecture as reported by datacenter + management solution. Known values are: "Unknown", "X86", and "X64". + :vartype operating_system_architecture: str or + ~azure.mgmt.migrationassessment.models.GuestOperatingSystemArchitecture + :ivar created_timestamp: When was machine first created. + :vartype created_timestamp: ~datetime.datetime + :ivar updated_timestamp: When was machine last updated. + :vartype updated_timestamp: ~datetime.datetime + :ivar display_name: Display Name of the Machine. + :vartype display_name: str + :ivar type: Assessed machine type. Known values are: "Unknown", "AssessedMachine", + "AvsAssessedMachine", and "SqlAssessedMachine". + :vartype type: str or ~azure.mgmt.migrationassessment.models.AssessedMachineType + :ivar description: Description for the machine. + :vartype description: str + :ivar datacenter_machine_arm_id: Data center machine ARM id. + :vartype datacenter_machine_arm_id: str + :ivar datacenter_management_server_arm_id: Data center management server ARM id. + :vartype datacenter_management_server_arm_id: str + :ivar datacenter_management_server_name: Data center management server name. + :vartype datacenter_management_server_name: str + :ivar megabytes_of_memory: Megabytes of memory found allocated for the machine in private data + center. + :vartype megabytes_of_memory: float + :ivar number_of_cores: Number of CPU cores found on the machine. + :vartype number_of_cores: int + :ivar confidence_rating_in_percentage: Confidence Rating in Percentage. + :vartype confidence_rating_in_percentage: float + :ivar percentage_cores_utilization: Percentile of Percentage of Cores Utilized noted during + time period T. + + Here N and T are settings on Assessment. + :vartype percentage_cores_utilization: float + :ivar percentage_memory_utilization: Percentile of Percentage of Memory Utilized noted during + time period T. + + .. code-block:: + + Here N and T are settings on Assessment. + :vartype percentage_memory_utilization: float + :ivar suitability: Gets a value indicating whether machine is suitable for the cloud platform + selected. Known values are: "Unknown", "NotSuitable", "Suitable", "ConditionallySuitable", and + "ReadinessUnknown". + :vartype suitability: str or ~azure.mgmt.migrationassessment.models.CloudSuitability + :ivar sizing_criterion: Assessment sizing criterion. Known values are: "PerformanceBased" and + "AsOnPremises". + :vartype sizing_criterion: str or + ~azure.mgmt.migrationassessment.models.AssessmentSizingCriterion + """ + + _validation = { + "bios_guid": {"readonly": True}, + "fqdn": {"readonly": True}, + "sql_instances": {"readonly": True}, + "suitability_detail": {"readonly": True}, + "suitability_explanation": {"readonly": True}, + "recommended_vm_size": {"readonly": True}, + "recommended_vm_family": {"readonly": True}, + "product_support_status": {"readonly": True}, + "recommended_vm_size_number_of_cores": {"readonly": True}, + "recommended_vm_size_megabytes_of_memory": {"readonly": True}, + "monthly_compute_cost": {"readonly": True}, + "disks": {"readonly": True}, + "network_adapters": {"readonly": True}, + "monthly_bandwidth_cost": {"readonly": True}, + "monthly_storage_cost": {"readonly": True}, + "security_suitability": {"readonly": True}, + "migration_guidelines": {"readonly": True}, + "boot_type": {"readonly": True}, + "operating_system_type": {"readonly": True}, + "operating_system_name": {"readonly": True}, + "operating_system_version": {"readonly": True}, + "operating_system_architecture": {"readonly": True}, + "created_timestamp": {"readonly": True}, + "updated_timestamp": {"readonly": True}, + "display_name": {"readonly": True}, + "type": {"readonly": True}, + "description": {"readonly": True}, + "datacenter_machine_arm_id": {"readonly": True}, + "datacenter_management_server_arm_id": {"readonly": True}, + "datacenter_management_server_name": {"readonly": True}, + "megabytes_of_memory": {"readonly": True}, + "number_of_cores": {"readonly": True}, + "confidence_rating_in_percentage": {"readonly": True}, + "percentage_cores_utilization": {"readonly": True}, + "percentage_memory_utilization": {"readonly": True}, + "suitability": {"readonly": True}, + "sizing_criterion": {"readonly": True}, + } + + _attribute_map = { + "bios_guid": {"key": "biosGuid", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, + "sql_instances": {"key": "sqlInstances", "type": "[AssessedSqlInstanceSummary]"}, + "suitability_detail": {"key": "suitabilityDetail", "type": "str"}, + "suitability_explanation": {"key": "suitabilityExplanation", "type": "str"}, + "recommended_vm_size": {"key": "recommendedVmSize", "type": "str"}, + "recommended_vm_family": {"key": "recommendedVmFamily", "type": "str"}, + "product_support_status": {"key": "productSupportStatus", "type": "ProductSupportStatus"}, + "recommended_vm_size_number_of_cores": {"key": "recommendedVmSizeNumberOfCores", "type": "int"}, + "recommended_vm_size_megabytes_of_memory": {"key": "recommendedVmSizeMegabytesOfMemory", "type": "float"}, + "monthly_compute_cost": {"key": "monthlyComputeCost", "type": "float"}, + "disks": {"key": "disks", "type": "{AssessedDiskData}"}, + "network_adapters": {"key": "networkAdapters", "type": "{SqlAssessedNetworkAdapter}"}, + "monthly_bandwidth_cost": {"key": "monthlyBandwidthCost", "type": "float"}, + "monthly_storage_cost": {"key": "monthlyStorageCost", "type": "float"}, + "cost_components": {"key": "costComponents", "type": "[CostComponent]"}, + "security_suitability": {"key": "securitySuitability", "type": "str"}, + "migration_guidelines": {"key": "migrationGuidelines", "type": "[SqlMigrationGuideline]"}, + "boot_type": {"key": "bootType", "type": "str"}, + "operating_system_type": {"key": "operatingSystemType", "type": "str"}, + "operating_system_name": {"key": "operatingSystemName", "type": "str"}, + "operating_system_version": {"key": "operatingSystemVersion", "type": "str"}, + "operating_system_architecture": {"key": "operatingSystemArchitecture", "type": "str"}, + "created_timestamp": {"key": "createdTimestamp", "type": "iso-8601"}, + "updated_timestamp": {"key": "updatedTimestamp", "type": "iso-8601"}, + "display_name": {"key": "displayName", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "datacenter_machine_arm_id": {"key": "datacenterMachineArmId", "type": "str"}, + "datacenter_management_server_arm_id": {"key": "datacenterManagementServerArmId", "type": "str"}, + "datacenter_management_server_name": {"key": "datacenterManagementServerName", "type": "str"}, + "megabytes_of_memory": {"key": "megabytesOfMemory", "type": "float"}, + "number_of_cores": {"key": "numberOfCores", "type": "int"}, + "confidence_rating_in_percentage": {"key": "confidenceRatingInPercentage", "type": "float"}, + "percentage_cores_utilization": {"key": "percentageCoresUtilization", "type": "float"}, + "percentage_memory_utilization": {"key": "percentageMemoryUtilization", "type": "float"}, + "suitability": {"key": "suitability", "type": "str"}, + "sizing_criterion": {"key": "sizingCriterion", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, *, cost_components: Optional[List["_models.CostComponent"]] = None, **kwargs: Any + ) -> None: + """ + :keyword cost_components: Gets the collection of cost components. + :paramtype cost_components: list[~azure.mgmt.migrationassessment.models.CostComponent] + """ + super().__init__(**kwargs) + self.bios_guid = None + self.fqdn = None + self.sql_instances = None + self.suitability_detail = None + self.suitability_explanation = None + self.recommended_vm_size = None + self.recommended_vm_family = None + self.product_support_status = None + self.recommended_vm_size_number_of_cores = None + self.recommended_vm_size_megabytes_of_memory = None + self.monthly_compute_cost = None + self.disks = None + self.network_adapters = None + self.monthly_bandwidth_cost = None + self.monthly_storage_cost = None + self.cost_components = cost_components + self.security_suitability = None + self.migration_guidelines = None + self.boot_type = None + self.operating_system_type = None + self.operating_system_name = None + self.operating_system_version = None + self.operating_system_architecture = None + self.created_timestamp = None + self.updated_timestamp = None + self.display_name = None + self.type = None + self.description = None + self.datacenter_machine_arm_id = None + self.datacenter_management_server_arm_id = None + self.datacenter_management_server_name = None + self.megabytes_of_memory = None + self.number_of_cores = None + self.confidence_rating_in_percentage = None + self.percentage_cores_utilization = None + self.percentage_memory_utilization = None + self.suitability = None + self.sizing_criterion = None + + +class AssessedSqlRecommendedEntity(ProxyResource): + """SQL Assessment REST 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: + ~azure.mgmt.migrationassessment.models.AssessedSqlRecommendedEntityProperties + """ + + _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": "AssessedSqlRecommendedEntityProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.AssessedSqlRecommendedEntityProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: + ~azure.mgmt.migrationassessment.models.AssessedSqlRecommendedEntityProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class AssessedSqlRecommendedEntityListResult(_serialization.Model): + """The response of a AssessedSqlRecommendedEntity list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The AssessedSqlRecommendedEntity items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.AssessedSqlRecommendedEntity] + :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": "[AssessedSqlRecommendedEntity]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.AssessedSqlRecommendedEntity"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The AssessedSqlRecommendedEntity items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.AssessedSqlRecommendedEntity] + :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 AssessedSqlRecommendedEntityProperties(_serialization.Model): + """Assessed SQL recommended entity properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar machine_name: Gets or sets machine name. + :vartype machine_name: str + :ivar instance_name: Gets or sets SQL instance name. + :vartype instance_name: str + :ivar product_support_status: Gets the product support status related details. + :vartype product_support_status: ~azure.mgmt.migrationassessment.models.ProductSupportStatus + :ivar db_count: Gets or sets assessed database count. + :vartype db_count: int + :ivar discovered_db_count: Gets or sets the total discovered database count. + :vartype discovered_db_count: int + :ivar has_scan_occurred: Gets or sets a value indicating whether instance deep discovery has + occurred or + not. + :vartype has_scan_occurred: bool + :ivar recommended_azure_sql_target_type: Gets or sets the recommended azure SQL target type. + Known values are: "Unknown", "Recommended", "AzureSqlDatabase", "AzureSqlManagedInstance", + "AzureSqlVirtualMachine", and "AzureVirtualMachine". + :vartype recommended_azure_sql_target_type: str or + ~azure.mgmt.migrationassessment.models.TargetType + :ivar recommended_suitability: Gets or sets the recommended azure SQL suitability. Known values + are: "Unknown", "SuitableForSqlDB", "SuitableForSqlMI", "SuitableForVM", + "PotentiallySuitableForVM", "ReadinessUnknown", "NotSuitable", "SuitableForSqlVM", + "ConditionallySuitableForSqlDB", "ConditionallySuitableForSqlMI", "ConditionallySuitableForVM", + and "ConditionallySuitableForSqlVM". + :vartype recommended_suitability: str or + ~azure.mgmt.migrationassessment.models.RecommendedSuitability + :ivar azure_sql_mi_suitability_details: SQL instance azure SQL MI suitability details. + :vartype azure_sql_mi_suitability_details: + ~azure.mgmt.migrationassessment.models.SqlAssessmentV2PaasSuitabilityData + :ivar azure_sql_db_suitability_details: SQL instance azure SQL DB suitability details. + :vartype azure_sql_db_suitability_details: + ~azure.mgmt.migrationassessment.models.SqlAssessmentV2PaasSuitabilityData + :ivar azure_sql_vm_suitability_details: SQL instance azure SQL VM suitability details. + :vartype azure_sql_vm_suitability_details: + ~azure.mgmt.migrationassessment.models.SqlAssessmentV2IaasSuitabilityData + :ivar assessed_sql_entity_arm_id: Gets or sets Arm id of assessed entity. + :vartype assessed_sql_entity_arm_id: str + :ivar is_clustered: Gets or sets a value indicating whether the SQL instance is clustered or + not. + :vartype is_clustered: bool + :ivar is_high_availability_enabled: Gets or sets a value indicating whether the high + availability is enabled or not. + :vartype is_high_availability_enabled: bool + :ivar sql_edition: Gets the SQL edition from the recommended entity if applicable. + :vartype sql_edition: str + :ivar sql_version: Gets the SQL version from the recommended entity if applicable. + :vartype sql_version: str + :ivar sizing_criterion: Assessment sizing criterion. Known values are: "PerformanceBased" and + "AsOnPremises". + :vartype sizing_criterion: str or + ~azure.mgmt.migrationassessment.models.AssessmentSizingCriterion + """ + + _validation = { + "machine_name": {"readonly": True}, + "instance_name": {"readonly": True}, + "product_support_status": {"readonly": True}, + "db_count": {"readonly": True}, + "discovered_db_count": {"readonly": True}, + "has_scan_occurred": {"readonly": True}, + "recommended_azure_sql_target_type": {"readonly": True}, + "recommended_suitability": {"readonly": True}, + "azure_sql_mi_suitability_details": {"readonly": True}, + "azure_sql_db_suitability_details": {"readonly": True}, + "azure_sql_vm_suitability_details": {"readonly": True}, + "is_clustered": {"readonly": True}, + "is_high_availability_enabled": {"readonly": True}, + "sql_edition": {"readonly": True}, + "sql_version": {"readonly": True}, + "sizing_criterion": {"readonly": True}, + } + + _attribute_map = { + "machine_name": {"key": "machineName", "type": "str"}, + "instance_name": {"key": "instanceName", "type": "str"}, + "product_support_status": {"key": "productSupportStatus", "type": "ProductSupportStatus"}, + "db_count": {"key": "dbCount", "type": "int"}, + "discovered_db_count": {"key": "discoveredDBCount", "type": "int"}, + "has_scan_occurred": {"key": "hasScanOccurred", "type": "bool"}, + "recommended_azure_sql_target_type": {"key": "recommendedAzureSqlTargetType", "type": "str"}, + "recommended_suitability": {"key": "recommendedSuitability", "type": "str"}, + "azure_sql_mi_suitability_details": { + "key": "azureSqlMISuitabilityDetails", + "type": "SqlAssessmentV2PaasSuitabilityData", + }, + "azure_sql_db_suitability_details": { + "key": "azureSqlDBSuitabilityDetails", + "type": "SqlAssessmentV2PaasSuitabilityData", + }, + "azure_sql_vm_suitability_details": { + "key": "azureSqlVMSuitabilityDetails", + "type": "SqlAssessmentV2IaasSuitabilityData", + }, + "assessed_sql_entity_arm_id": {"key": "assessedSqlEntityArmId", "type": "str"}, + "is_clustered": {"key": "isClustered", "type": "bool"}, + "is_high_availability_enabled": {"key": "isHighAvailabilityEnabled", "type": "bool"}, + "sql_edition": {"key": "sqlEdition", "type": "str"}, + "sql_version": {"key": "sqlVersion", "type": "str"}, + "sizing_criterion": {"key": "sizingCriterion", "type": "str"}, + } + + def __init__(self, *, assessed_sql_entity_arm_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword assessed_sql_entity_arm_id: Gets or sets Arm id of assessed entity. + :paramtype assessed_sql_entity_arm_id: str + """ + super().__init__(**kwargs) + self.machine_name = None + self.instance_name = None + self.product_support_status = None + self.db_count = None + self.discovered_db_count = None + self.has_scan_occurred = None + self.recommended_azure_sql_target_type = None + self.recommended_suitability = None + self.azure_sql_mi_suitability_details = None + self.azure_sql_db_suitability_details = None + self.azure_sql_vm_suitability_details = None + self.assessed_sql_entity_arm_id = assessed_sql_entity_arm_id + self.is_clustered = None + self.is_high_availability_enabled = None + self.sql_edition = None + self.sql_version = None + self.sizing_criterion = None + + +class WebApp(_serialization.Model): + """Data model of Web App. + + 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 discovery_arm_id: Gets discovery arm id. Required. + :vartype discovery_arm_id: str + :ivar display_name: Gets display name. Required. + :vartype display_name: str + :ivar web_server_arm_id: Gets web server arm id. Required. + :vartype web_server_arm_id: str + :ivar web_server_display_name: Gets web server display name. Required. + :vartype web_server_display_name: str + :ivar machine_arm_id: Gets machine arm id. Required. + :vartype machine_arm_id: str + :ivar machine_display_name: Gets machine display name. Required. + :vartype machine_display_name: str + :ivar web_app_type: Gets web app type. Required. Known values are: "Unknown", "IIS", and + "Tomcat". + :vartype web_app_type: str or ~azure.mgmt.migrationassessment.models.WebAppType + """ + + _validation = { + "discovery_arm_id": {"required": True, "readonly": True}, + "display_name": {"required": True, "readonly": True}, + "web_server_arm_id": {"required": True, "readonly": True}, + "web_server_display_name": {"required": True, "readonly": True}, + "machine_arm_id": {"required": True, "readonly": True}, + "machine_display_name": {"required": True, "readonly": True}, + "web_app_type": {"required": True, "readonly": True}, + } + + _attribute_map = { + "discovery_arm_id": {"key": "discoveryArmId", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "web_server_arm_id": {"key": "webServerArmId", "type": "str"}, + "web_server_display_name": {"key": "webServerDisplayName", "type": "str"}, + "machine_arm_id": {"key": "machineArmId", "type": "str"}, + "machine_display_name": {"key": "machineDisplayName", "type": "str"}, + "web_app_type": {"key": "webAppType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.discovery_arm_id = None + self.display_name = None + self.web_server_arm_id = None + self.web_server_display_name = None + self.machine_arm_id = None + self.machine_display_name = None + self.web_app_type = None + + +class AssessedWebApp(WebApp): + """Data model of Assessed Web App. + + 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 discovery_arm_id: Gets discovery arm id. Required. + :vartype discovery_arm_id: str + :ivar display_name: Gets display name. Required. + :vartype display_name: str + :ivar web_server_arm_id: Gets web server arm id. Required. + :vartype web_server_arm_id: str + :ivar web_server_display_name: Gets web server display name. Required. + :vartype web_server_display_name: str + :ivar machine_arm_id: Gets machine arm id. Required. + :vartype machine_arm_id: str + :ivar machine_display_name: Gets machine display name. Required. + :vartype machine_display_name: str + :ivar web_app_type: Gets web app type. Required. Known values are: "Unknown", "IIS", and + "Tomcat". + :vartype web_app_type: str or ~azure.mgmt.migrationassessment.models.WebAppType + :ivar suitability_result: Gets suitability result. + :vartype suitability_result: ~azure.mgmt.migrationassessment.models.SuitabilityResult + :ivar recommendation_result: Gets recommendation result. + :vartype recommendation_result: ~azure.mgmt.migrationassessment.models.RecommendationResult + """ + + _validation = { + "discovery_arm_id": {"required": True, "readonly": True}, + "display_name": {"required": True, "readonly": True}, + "web_server_arm_id": {"required": True, "readonly": True}, + "web_server_display_name": {"required": True, "readonly": True}, + "machine_arm_id": {"required": True, "readonly": True}, + "machine_display_name": {"required": True, "readonly": True}, + "web_app_type": {"required": True, "readonly": True}, + "suitability_result": {"readonly": True}, + "recommendation_result": {"readonly": True}, + } + + _attribute_map = { + "discovery_arm_id": {"key": "discoveryArmId", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "web_server_arm_id": {"key": "webServerArmId", "type": "str"}, + "web_server_display_name": {"key": "webServerDisplayName", "type": "str"}, + "machine_arm_id": {"key": "machineArmId", "type": "str"}, + "machine_display_name": {"key": "machineDisplayName", "type": "str"}, + "web_app_type": {"key": "webAppType", "type": "str"}, + "suitability_result": {"key": "suitabilityResult", "type": "SuitabilityResult"}, + "recommendation_result": {"key": "recommendationResult", "type": "RecommendationResult"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.suitability_result = None + self.recommendation_result = None + + +class AssessedWebApplication(ProxyResource): + """ARM model of Assessed Web Application. + + 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.AssessedWebApplicationProperties + :ivar e_tag: 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 e_tag: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "e_tag": {"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": "AssessedWebApplicationProperties"}, + "e_tag": {"key": "eTag", "type": "str"}, + } + + def __init__( + self, *, properties: Optional["_models.AssessedWebApplicationProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.AssessedWebApplicationProperties + """ + super().__init__(**kwargs) + self.properties = properties + self.e_tag = None + + +class AssessedWebApplicationListResult(_serialization.Model): + """The response of a AssessedWebApplication list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The AssessedWebApplication items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.AssessedWebApplication] + :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": "[AssessedWebApplication]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.AssessedWebApplication"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The AssessedWebApplication items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.AssessedWebApplication] + :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 AssessedWebApplicationProperties(AssessedWebApp): + """ARM model of Assessed Web Application 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 discovery_arm_id: Gets discovery arm id. Required. + :vartype discovery_arm_id: str + :ivar display_name: Gets display name. Required. + :vartype display_name: str + :ivar web_server_arm_id: Gets web server arm id. Required. + :vartype web_server_arm_id: str + :ivar web_server_display_name: Gets web server display name. Required. + :vartype web_server_display_name: str + :ivar machine_arm_id: Gets machine arm id. Required. + :vartype machine_arm_id: str + :ivar machine_display_name: Gets machine display name. Required. + :vartype machine_display_name: str + :ivar web_app_type: Gets web app type. Required. Known values are: "Unknown", "IIS", and + "Tomcat". + :vartype web_app_type: str or ~azure.mgmt.migrationassessment.models.WebAppType + :ivar suitability_result: Gets suitability result. + :vartype suitability_result: ~azure.mgmt.migrationassessment.models.SuitabilityResult + :ivar recommendation_result: Gets recommendation result. + :vartype recommendation_result: ~azure.mgmt.migrationassessment.models.RecommendationResult + """ + + +class AssessedWebAppV2(ProxyResource): + """Assessed Web app web model class. + + 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.AssessedWebAppV2Properties + """ + + _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": "AssessedWebAppV2Properties"}, + } + + def __init__(self, *, properties: Optional["_models.AssessedWebAppV2Properties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.AssessedWebAppV2Properties + """ + super().__init__(**kwargs) + self.properties = properties + + +class AssessedWebAppV2ListResult(_serialization.Model): + """The response of a AssessedWebAppV2 list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The AssessedWebAppV2 items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.AssessedWebAppV2] + :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": "[AssessedWebAppV2]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.AssessedWebAppV2"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The AssessedWebAppV2 items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.AssessedWebAppV2] + :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 AssessedWebAppV2Properties(_serialization.Model): + """Assessed Web app database properties web model. + + 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 web_app_type: Gets or sets the web app type. Known values are: "Unknown", "IIS", and + "Tomcat". + :vartype web_app_type: str or ~azure.mgmt.migrationassessment.models.WebAppType + :ivar target_specific_result: Gets or sets the target specific result. + :vartype target_specific_result: dict[str, + ~azure.mgmt.migrationassessment.models.TargetSpecificResult] + :ivar app_service_plan_name: Gets or sets the app service plan name. Required. + :vartype app_service_plan_name: str + :ivar machine_name: Gets the machine name. Required. + :vartype machine_name: str + :ivar server_arm_id: Gets or sets the server ARM Id. + :vartype server_arm_id: str + :ivar web_server_name: Gets or sets the web server name. + :vartype web_server_name: str + :ivar web_app_name: Gets or sets web app name. + :vartype web_app_name: str + :ivar discovered_web_app_id: Gets the discovered web app ID. + :vartype discovered_web_app_id: str + :ivar discovered_machine_id: Machine arm id. + :vartype discovered_machine_id: str + :ivar confidence_rating_in_percentage: Confidence Rating in Percentage. + :vartype confidence_rating_in_percentage: float + :ivar created_timestamp: When was assessed SQL database first created. + :vartype created_timestamp: ~datetime.datetime + :ivar updated_timestamp: When was assessed Web app database last updated. + :vartype updated_timestamp: ~datetime.datetime + """ + + _validation = { + "web_app_type": {"readonly": True}, + "target_specific_result": {"readonly": True}, + "app_service_plan_name": {"required": True, "readonly": True}, + "machine_name": {"required": True, "readonly": True}, + "server_arm_id": {"readonly": True}, + "web_server_name": {"readonly": True}, + "web_app_name": {"readonly": True}, + "discovered_web_app_id": {"readonly": True}, + "discovered_machine_id": {"readonly": True}, + "confidence_rating_in_percentage": {"readonly": True}, + "created_timestamp": {"readonly": True}, + "updated_timestamp": {"readonly": True}, + } + + _attribute_map = { + "web_app_type": {"key": "webAppType", "type": "str"}, + "target_specific_result": {"key": "targetSpecificResult", "type": "{TargetSpecificResult}"}, + "app_service_plan_name": {"key": "appServicePlanName", "type": "str"}, + "machine_name": {"key": "machineName", "type": "str"}, + "server_arm_id": {"key": "serverArmId", "type": "str"}, + "web_server_name": {"key": "webServerName", "type": "str"}, + "web_app_name": {"key": "webAppName", "type": "str"}, + "discovered_web_app_id": {"key": "discoveredWebAppId", "type": "str"}, + "discovered_machine_id": {"key": "discoveredMachineId", "type": "str"}, + "confidence_rating_in_percentage": {"key": "confidenceRatingInPercentage", "type": "float"}, + "created_timestamp": {"key": "createdTimestamp", "type": "iso-8601"}, + "updated_timestamp": {"key": "updatedTimestamp", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.web_app_type = None + self.target_specific_result = None + self.app_service_plan_name = None + self.machine_name = None + self.server_arm_id = None + self.web_server_name = None + self.web_app_name = None + self.discovered_web_app_id = None + self.discovered_machine_id = None + self.confidence_rating_in_percentage = None + self.created_timestamp = None + self.updated_timestamp = None + + +class Assessment(ProxyResource): + """Machine assessment 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.MachineAssessmentProperties + """ + + _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": "MachineAssessmentProperties"}, + } + + def __init__(self, *, properties: Optional["_models.MachineAssessmentProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.MachineAssessmentProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class AssessmentListResult(_serialization.Model): + """The response of a Assessment list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The Assessment items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.Assessment] + :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": "[Assessment]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.Assessment"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The Assessment items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.Assessment] + :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 AssessmentOptions(ProxyResource): + """Assessment options 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.AssessmentOptionsProperties + """ + + _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": "AssessmentOptionsProperties"}, + } + + def __init__(self, *, properties: Optional["_models.AssessmentOptionsProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.AssessmentOptionsProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class AssessmentOptionsListResult(_serialization.Model): + """The response of a AssessmentOptions list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The AssessmentOptions items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.AssessmentOptions] + :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": "[AssessmentOptions]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.AssessmentOptions"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The AssessmentOptions items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.AssessmentOptions] + :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 AssessmentOptionsProperties(_serialization.Model): + """Assessment options properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar vm_families: Dictionary of VM families grouped by vm family name describing the targeted + azure locations of VM family and the category of the family. + :vartype vm_families: list[~azure.mgmt.migrationassessment.models.VmFamilyOptions] + :ivar reserved_instance_vm_families: List of supported VM Families. + :vartype reserved_instance_vm_families: list[str] + :ivar reserved_instance_supported_locations: List of supported Azure regions for reserved + instances. + :vartype reserved_instance_supported_locations: list[str] + :ivar reserved_instance_supported_currencies: List of supported currencies for reserved + instances. + :vartype reserved_instance_supported_currencies: list[str] + :ivar reserved_instance_supported_offers: List of supported Azure offer codes for reserved + instances. + :vartype reserved_instance_supported_offers: list[str] + :ivar ultra_disk_vm_families: Ultra disk related assessment options. + :vartype ultra_disk_vm_families: + list[~azure.mgmt.migrationassessment.models.UltraDiskAssessmentOptions] + :ivar premium_disk_vm_families: List of VM Families that support premium disks for assessments. + :vartype premium_disk_vm_families: list[str] + :ivar savings_plan_vm_families: List of VM Families that support Savings plan offer for + assessments. + :vartype savings_plan_vm_families: list[str] + :ivar savings_plan_supported_locations: List of Azure locations that support Savings plan offer + for assessments. + :vartype savings_plan_supported_locations: list[str] + :ivar premium_v2_disk_supported_locations: List of Azure locations that support Premium SSD V2 + disks for assessments. + :vartype premium_v2_disk_supported_locations: list[str or + ~azure.mgmt.migrationassessment.models.AzureLocation] + """ + + _validation = { + "vm_families": {"readonly": True}, + "reserved_instance_vm_families": {"readonly": True}, + "reserved_instance_supported_locations": {"readonly": True}, + "reserved_instance_supported_currencies": {"readonly": True}, + "reserved_instance_supported_offers": {"readonly": True}, + "ultra_disk_vm_families": {"readonly": True}, + "premium_disk_vm_families": {"readonly": True}, + "savings_plan_vm_families": {"readonly": True}, + "savings_plan_supported_locations": {"readonly": True}, + "premium_v2_disk_supported_locations": {"readonly": True}, + } + + _attribute_map = { + "vm_families": {"key": "vmFamilies", "type": "[VmFamilyOptions]"}, + "reserved_instance_vm_families": {"key": "reservedInstanceVmFamilies", "type": "[str]"}, + "reserved_instance_supported_locations": {"key": "reservedInstanceSupportedLocations", "type": "[str]"}, + "reserved_instance_supported_currencies": {"key": "reservedInstanceSupportedCurrencies", "type": "[str]"}, + "reserved_instance_supported_offers": {"key": "reservedInstanceSupportedOffers", "type": "[str]"}, + "ultra_disk_vm_families": {"key": "ultraDiskVmFamilies", "type": "[UltraDiskAssessmentOptions]"}, + "premium_disk_vm_families": {"key": "premiumDiskVmFamilies", "type": "[str]"}, + "savings_plan_vm_families": {"key": "savingsPlanVmFamilies", "type": "[str]"}, + "savings_plan_supported_locations": {"key": "savingsPlanSupportedLocations", "type": "[str]"}, + "premium_v2_disk_supported_locations": {"key": "premiumV2DiskSupportedLocations", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.vm_families = None + self.reserved_instance_vm_families = None + self.reserved_instance_supported_locations = None + self.reserved_instance_supported_currencies = None + self.reserved_instance_supported_offers = None + self.ultra_disk_vm_families = None + self.premium_disk_vm_families = None + self.savings_plan_vm_families = None + self.savings_plan_supported_locations = None + self.premium_v2_disk_supported_locations = None + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. 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.migrationassessment.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class AssessmentProject(TrackedResource): + """An Assessment project site resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. 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.migrationassessment.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.ProjectProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "ProjectProperties"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.ProjectProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.ProjectProperties + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class AssessmentProjectListResult(_serialization.Model): + """The response of a AssessmentProject list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The AssessmentProject items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.AssessmentProject] + :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": "[AssessmentProject]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.AssessmentProject"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The AssessmentProject items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.AssessmentProject] + :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 AssessmentProjectSummary(ProxyResource): + """Assessment project summary 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.AssessmentProjectSummaryProperties + """ + + _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": "AssessmentProjectSummaryProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.AssessmentProjectSummaryProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: + ~azure.mgmt.migrationassessment.models.AssessmentProjectSummaryProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class AssessmentProjectSummaryListResult(_serialization.Model): + """The response of a AssessmentProjectSummary list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The AssessmentProjectSummary items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.AssessmentProjectSummary] + :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": "[AssessmentProjectSummary]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.AssessmentProjectSummary"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The AssessmentProjectSummary items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.AssessmentProjectSummary] + :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 AssessmentProjectSummaryProperties(_serialization.Model): + """Assessment project summary properties class. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error_summary_affected_entities: Gets the Error summary by feature. Contains number of + affected Entities per + feature. + :vartype error_summary_affected_entities: + list[~azure.mgmt.migrationassessment.models.ErrorSummary] + :ivar number_of_private_endpoint_connections: Gets the number of private endpoint connections. + :vartype number_of_private_endpoint_connections: int + :ivar number_of_groups: Gets the number of groups created in this project. + :vartype number_of_groups: int + :ivar number_of_machines: Gets the number of machines part of this project. + :vartype number_of_machines: int + :ivar number_of_import_machines: Gets the number of import machines part of this project. + :vartype number_of_import_machines: int + :ivar number_of_assessments: Gets the number of assessments created in this project. + :vartype number_of_assessments: int + :ivar last_assessment_timestamp: Gets the last assessment timestamp. + :vartype last_assessment_timestamp: ~datetime.datetime + """ + + _validation = { + "error_summary_affected_entities": {"readonly": True}, + "number_of_private_endpoint_connections": {"readonly": True}, + "number_of_groups": {"readonly": True}, + "number_of_machines": {"readonly": True}, + "number_of_import_machines": {"readonly": True}, + "number_of_assessments": {"readonly": True}, + "last_assessment_timestamp": {"readonly": True}, + } + + _attribute_map = { + "error_summary_affected_entities": {"key": "errorSummaryAffectedEntities", "type": "[ErrorSummary]"}, + "number_of_private_endpoint_connections": {"key": "numberOfPrivateEndpointConnections", "type": "int"}, + "number_of_groups": {"key": "numberOfGroups", "type": "int"}, + "number_of_machines": {"key": "numberOfMachines", "type": "int"}, + "number_of_import_machines": {"key": "numberOfImportMachines", "type": "int"}, + "number_of_assessments": {"key": "numberOfAssessments", "type": "int"}, + "last_assessment_timestamp": {"key": "lastAssessmentTimestamp", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.error_summary_affected_entities = None + self.number_of_private_endpoint_connections = None + self.number_of_groups = None + self.number_of_machines = None + self.number_of_import_machines = None + self.number_of_assessments = None + self.last_assessment_timestamp = None + + +class AssessmentProjectUpdate(_serialization.Model): + """The type used for update operations of the AssessmentProject. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: The updatable properties of the AssessmentProject. + :vartype properties: ~azure.mgmt.migrationassessment.models.AssessmentProjectUpdateProperties + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "AssessmentProjectUpdateProperties"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.AssessmentProjectUpdateProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: The updatable properties of the AssessmentProject. + :paramtype properties: ~azure.mgmt.migrationassessment.models.AssessmentProjectUpdateProperties + """ + super().__init__(**kwargs) + self.tags = tags + self.properties = properties + + +class AssessmentProjectUpdateProperties(_serialization.Model): + """The updatable properties of the AssessmentProject. + + :ivar assessment_solution_id: Assessment solution ARM id tracked by + Microsoft.Migrate/migrateProjects. + :vartype assessment_solution_id: str + :ivar project_status: Assessment project status. Known values are: "Active" and "Inactive". + :vartype project_status: str or ~azure.mgmt.migrationassessment.models.ProjectStatus + :ivar customer_workspace_id: The ARM id of service map workspace created by customer. + :vartype customer_workspace_id: str + :ivar customer_workspace_location: Location of service map workspace created by customer. + :vartype customer_workspace_location: str + :ivar public_network_access: This value can be set to 'enabled' to avoid breaking changes on + existing + customer resources and templates. If set to 'disabled', traffic over public + interface is not allowed, and private endpoint connections would be the + exclusive access method. + :vartype public_network_access: str + :ivar customer_storage_account_arm_id: The ARM id of the storage account used for interactions + when public access is + disabled. + :vartype customer_storage_account_arm_id: str + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningState + """ + + _attribute_map = { + "assessment_solution_id": {"key": "assessmentSolutionId", "type": "str"}, + "project_status": {"key": "projectStatus", "type": "str"}, + "customer_workspace_id": {"key": "customerWorkspaceId", "type": "str"}, + "customer_workspace_location": {"key": "customerWorkspaceLocation", "type": "str"}, + "public_network_access": {"key": "publicNetworkAccess", "type": "str"}, + "customer_storage_account_arm_id": {"key": "customerStorageAccountArmId", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + assessment_solution_id: Optional[str] = None, + project_status: Optional[Union[str, "_models.ProjectStatus"]] = None, + customer_workspace_id: Optional[str] = None, + customer_workspace_location: Optional[str] = None, + public_network_access: Optional[str] = None, + customer_storage_account_arm_id: Optional[str] = None, + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword assessment_solution_id: Assessment solution ARM id tracked by + Microsoft.Migrate/migrateProjects. + :paramtype assessment_solution_id: str + :keyword project_status: Assessment project status. Known values are: "Active" and "Inactive". + :paramtype project_status: str or ~azure.mgmt.migrationassessment.models.ProjectStatus + :keyword customer_workspace_id: The ARM id of service map workspace created by customer. + :paramtype customer_workspace_id: str + :keyword customer_workspace_location: Location of service map workspace created by customer. + :paramtype customer_workspace_location: str + :keyword public_network_access: This value can be set to 'enabled' to avoid breaking changes on + existing + customer resources and templates. If set to 'disabled', traffic over public + interface is not allowed, and private endpoint connections would be the + exclusive access method. + :paramtype public_network_access: str + :keyword customer_storage_account_arm_id: The ARM id of the storage account used for + interactions when public access is + disabled. + :paramtype customer_storage_account_arm_id: str + :keyword provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :paramtype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningState + """ + super().__init__(**kwargs) + self.assessment_solution_id = assessment_solution_id + self.project_status = project_status + self.customer_workspace_id = customer_workspace_id + self.customer_workspace_location = customer_workspace_location + self.public_network_access = public_network_access + self.customer_storage_account_arm_id = customer_storage_account_arm_id + self.provisioning_state = provisioning_state + + +class AssessmentResult(_serialization.Model): + """Assessment results. + + All required parameters must be populated in order to send to server. + + :ivar app_service_plan_name: Gets or sets the app service plan name. Required. + :vartype app_service_plan_name: str + :ivar suitability: Gets or sets the suitability. Required. Known values are: "Unknown", + "NotSuitable", "Suitable", "ConditionallySuitable", and "ReadinessUnknown". + :vartype suitability: str or ~azure.mgmt.migrationassessment.models.CloudSuitability + :ivar security_suitability: Gets or sets the security suitability. Required. Known values are: + "Unknown", "NotSuitable", "Suitable", "ConditionallySuitable", and "ReadinessUnknown". + :vartype security_suitability: str or ~azure.mgmt.migrationassessment.models.CloudSuitability + :ivar web_app_sku_name: Gets or sets the web app sku name. Required. + :vartype web_app_sku_name: str + :ivar web_app_sku_size: Gets or sets the web app sku size. Required. + :vartype web_app_sku_size: str + """ + + _validation = { + "app_service_plan_name": {"required": True}, + "suitability": {"required": True}, + "security_suitability": {"required": True}, + "web_app_sku_name": {"required": True}, + "web_app_sku_size": {"required": True}, + } + + _attribute_map = { + "app_service_plan_name": {"key": "appServicePlanName", "type": "str"}, + "suitability": {"key": "suitability", "type": "str"}, + "security_suitability": {"key": "securitySuitability", "type": "str"}, + "web_app_sku_name": {"key": "webAppSkuName", "type": "str"}, + "web_app_sku_size": {"key": "webAppSkuSize", "type": "str"}, + } + + def __init__( + self, + *, + app_service_plan_name: str, + suitability: Union[str, "_models.CloudSuitability"], + security_suitability: Union[str, "_models.CloudSuitability"], + web_app_sku_name: str, + web_app_sku_size: str, + **kwargs: Any + ) -> None: + """ + :keyword app_service_plan_name: Gets or sets the app service plan name. Required. + :paramtype app_service_plan_name: str + :keyword suitability: Gets or sets the suitability. Required. Known values are: "Unknown", + "NotSuitable", "Suitable", "ConditionallySuitable", and "ReadinessUnknown". + :paramtype suitability: str or ~azure.mgmt.migrationassessment.models.CloudSuitability + :keyword security_suitability: Gets or sets the security suitability. Required. Known values + are: "Unknown", "NotSuitable", "Suitable", "ConditionallySuitable", and "ReadinessUnknown". + :paramtype security_suitability: str or ~azure.mgmt.migrationassessment.models.CloudSuitability + :keyword web_app_sku_name: Gets or sets the web app sku name. Required. + :paramtype web_app_sku_name: str + :keyword web_app_sku_size: Gets or sets the web app sku size. Required. + :paramtype web_app_sku_size: str + """ + super().__init__(**kwargs) + self.app_service_plan_name = app_service_plan_name + self.suitability = suitability + self.security_suitability = security_suitability + self.web_app_sku_name = web_app_sku_name + self.web_app_sku_size = web_app_sku_size + + +class AssessmentScopeParameters(_serialization.Model): + """Data model of Assessment Scope Parameters. + + :ivar server_group_id: Gets or sets the server group id. + :vartype server_group_id: str + """ + + _attribute_map = { + "server_group_id": {"key": "serverGroupId", "type": "str"}, + } + + def __init__(self, *, server_group_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword server_group_id: Gets or sets the server group id. + :paramtype server_group_id: str + """ + super().__init__(**kwargs) + self.server_group_id = server_group_id + + +class AvsAssessedDisk(_serialization.Model): + """AVS assessed disk web model class. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Gets the ID of the disk. + :vartype name: str + :ivar display_name: Gets the display name of the disk. + :vartype display_name: str + :ivar gigabytes_provisioned: Gigabytes Provisioned for a disk in private data center. + :vartype gigabytes_provisioned: float + :ivar megabytes_per_second_of_read: Disk Read Throughput in MB/s. + :vartype megabytes_per_second_of_read: float + :ivar megabytes_per_second_of_write: Disk Write Throughput in MB/s. + :vartype megabytes_per_second_of_write: float + :ivar number_of_read_operations_per_second: Read Operations per second. + :vartype number_of_read_operations_per_second: float + :ivar number_of_write_operations_per_second: Write Operations per second. + :vartype number_of_write_operations_per_second: float + :ivar assessed_external_storage_type: Associated storage Type recommended for Disk. Known + values are: "Unknown", "None", "AnfStandard", "AnfPremium", and "AnfUltra". + :vartype assessed_external_storage_type: str or + ~azure.mgmt.migrationassessment.models.ExternalStorageType + :ivar estimated_disk_size_in_gb: Estimated Disk Size in GB. + :vartype estimated_disk_size_in_gb: float + :ivar suitability_detail: Gets the suitability detail. Known values are: "None", + "NumberOfReadOperationsPerSecondMissing", "NumberOfWriteOperationsPerSecondMissing", + "MegabytesPerSecondOfReadMissing", "MegabytesPerSecondOfWriteMissing", + "DiskGigabytesConsumedMissing", "DiskGigabytesProvisionedMissing", + "NumberOfReadOperationsPerSecondOutOfRange", "NumberOfWriteOperationsPerSecondOutOfRange", + "MegabytesPerSecondOfReadOutOfRange", "MegabytesPerSecondOfWriteOutOfRange", + "DiskGigabytesConsumedOutOfRange", and "DiskGigabytesProvisionedOutOfRange". + :vartype suitability_detail: str or + ~azure.mgmt.migrationassessment.models.AzureDiskSuitabilityDetail + """ + + _validation = { + "name": {"readonly": True}, + "display_name": {"readonly": True}, + "gigabytes_provisioned": {"readonly": True}, + "megabytes_per_second_of_read": {"readonly": True}, + "megabytes_per_second_of_write": {"readonly": True}, + "number_of_read_operations_per_second": {"readonly": True}, + "number_of_write_operations_per_second": {"readonly": True}, + "assessed_external_storage_type": {"readonly": True}, + "estimated_disk_size_in_gb": {"readonly": True}, + "suitability_detail": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "gigabytes_provisioned": {"key": "gigabytesProvisioned", "type": "float"}, + "megabytes_per_second_of_read": {"key": "megabytesPerSecondOfRead", "type": "float"}, + "megabytes_per_second_of_write": {"key": "megabytesPerSecondOfWrite", "type": "float"}, + "number_of_read_operations_per_second": {"key": "numberOfReadOperationsPerSecond", "type": "float"}, + "number_of_write_operations_per_second": {"key": "numberOfWriteOperationsPerSecond", "type": "float"}, + "assessed_external_storage_type": {"key": "assessedExternalStorageType", "type": "str"}, + "estimated_disk_size_in_gb": {"key": "estimatedDiskSizeInGB", "type": "float"}, + "suitability_detail": {"key": "suitabilityDetail", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.display_name = None + self.gigabytes_provisioned = None + self.megabytes_per_second_of_read = None + self.megabytes_per_second_of_write = None + self.number_of_read_operations_per_second = None + self.number_of_write_operations_per_second = None + self.assessed_external_storage_type = None + self.estimated_disk_size_in_gb = None + self.suitability_detail = None + + +class AvsAssessedMachine(ProxyResource): + """AVS assessment Assessed Machine 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.AvsAssessedMachineProperties + """ + + _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": "AvsAssessedMachineProperties"}, + } + + def __init__(self, *, properties: Optional["_models.AvsAssessedMachineProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.AvsAssessedMachineProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class AvsAssessedMachineListResult(_serialization.Model): + """The response of a AvsAssessedMachine list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The AvsAssessedMachine items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.AvsAssessedMachine] + :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": "[AvsAssessedMachine]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.AvsAssessedMachine"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The AvsAssessedMachine items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.AvsAssessedMachine] + :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 AvsAssessedMachineProperties(_serialization.Model): + """AVS assessed machine properties web model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar errors: List of errors for this machine. + :vartype errors: list[~azure.mgmt.migrationassessment.models.Error] + :ivar disks: List of Disks that were assessed as part of this machine's assessment. + :vartype disks: dict[str, ~azure.mgmt.migrationassessment.models.AvsAssessedDisk] + :ivar network_adapters: List of Network Adapters that were assessed as part of this machine's + assessment. + :vartype network_adapters: dict[str, + ~azure.mgmt.migrationassessment.models.AvsAssessedNetworkAdapter] + :ivar storage_in_use_gb: Gets the storage in use. + :vartype storage_in_use_gb: float + :ivar suitability_explanation: Gets the explanation if machine is not suitable for cloud. Known + values are: "Unknown", "NotApplicable", "IpV6NotSupported", and "UnsupportedOperatingSystem". + :vartype suitability_explanation: str or + ~azure.mgmt.migrationassessment.models.AzureAvsVmSuitabilityExplanation + :ivar suitability_detail: Gets the details if machine is not suitable for cloud. Known values + are: "None", "PercentageOfCoresUtilizedMissing", "PercentageOfMemoryUtilizedMissing", + "PercentageOfCoresUtilizedOutOfRange", "PercentageOfMemoryUtilizedOutOfRange", and + "PercentageOfStorageUtilizedOutOfRange". + :vartype suitability_detail: str or + ~azure.mgmt.migrationassessment.models.AzureAvsVmSuitabilityDetail + :ivar type: Assessed machine type. Known values are: "Unknown", "AssessedMachine", + "AvsAssessedMachine", and "SqlAssessedMachine". + :vartype type: str or ~azure.mgmt.migrationassessment.models.AssessedMachineType + :ivar boot_type: Boot type of machine discovered in private data center. Known values are: + "Unknown", "EFI", "BIOS", and "NotSpecified". + :vartype boot_type: str or ~azure.mgmt.migrationassessment.models.MachineBootType + :ivar operating_system_type: Operating system as reported by datacenter management solution. + :vartype operating_system_type: str + :ivar operating_system_name: Operating system as reported by datacenter management solution. + :vartype operating_system_name: str + :ivar operating_system_version: Operating system version as reported by datacenter management + solution. + :vartype operating_system_version: str + :ivar operating_system_architecture: Operating system architecture as reported by datacenter + management solution. Known values are: "Unknown", "X86", and "X64". + :vartype operating_system_architecture: str or + ~azure.mgmt.migrationassessment.models.GuestOperatingSystemArchitecture + :ivar created_timestamp: When was machine first created. + :vartype created_timestamp: ~datetime.datetime + :ivar updated_timestamp: When was machine last updated. + :vartype updated_timestamp: ~datetime.datetime + :ivar display_name: Display Name of the Machine. + :vartype display_name: str + :ivar description: Description for the machine. + :vartype description: str + :ivar datacenter_machine_arm_id: Data center machine ARM id. + :vartype datacenter_machine_arm_id: str + :ivar datacenter_management_server_arm_id: Data center management server ARM id. + :vartype datacenter_management_server_arm_id: str + :ivar datacenter_management_server_name: Data center management server name. + :vartype datacenter_management_server_name: str + :ivar megabytes_of_memory: Megabytes of memory found allocated for the machine in private data + center. + :vartype megabytes_of_memory: float + :ivar number_of_cores: Number of CPU cores found on the machine. + :vartype number_of_cores: int + :ivar confidence_rating_in_percentage: Confidence Rating in Percentage. + :vartype confidence_rating_in_percentage: float + :ivar percentage_cores_utilization: Percentile of Percentage of Cores Utilized noted during + time period T. + + Here N and T are settings on Assessment. + :vartype percentage_cores_utilization: float + :ivar percentage_memory_utilization: Percentile of Percentage of Memory Utilized noted during + time period T. + + .. code-block:: + + Here N and T are settings on Assessment. + :vartype percentage_memory_utilization: float + :ivar suitability: Gets a value indicating whether machine is suitable for the cloud platform + selected. Known values are: "Unknown", "NotSuitable", "Suitable", "ConditionallySuitable", and + "ReadinessUnknown". + :vartype suitability: str or ~azure.mgmt.migrationassessment.models.CloudSuitability + """ + + _validation = { + "errors": {"readonly": True}, + "disks": {"readonly": True}, + "network_adapters": {"readonly": True}, + "storage_in_use_gb": {"readonly": True}, + "suitability_explanation": {"readonly": True}, + "suitability_detail": {"readonly": True}, + "type": {"readonly": True}, + "boot_type": {"readonly": True}, + "operating_system_type": {"readonly": True}, + "operating_system_name": {"readonly": True}, + "operating_system_version": {"readonly": True}, + "operating_system_architecture": {"readonly": True}, + "created_timestamp": {"readonly": True}, + "updated_timestamp": {"readonly": True}, + "display_name": {"readonly": True}, + "description": {"readonly": True}, + "datacenter_machine_arm_id": {"readonly": True}, + "datacenter_management_server_arm_id": {"readonly": True}, + "datacenter_management_server_name": {"readonly": True}, + "megabytes_of_memory": {"readonly": True}, + "number_of_cores": {"readonly": True}, + "confidence_rating_in_percentage": {"readonly": True}, + "percentage_cores_utilization": {"readonly": True}, + "percentage_memory_utilization": {"readonly": True}, + "suitability": {"readonly": True}, + } + + _attribute_map = { + "errors": {"key": "errors", "type": "[Error]"}, + "disks": {"key": "disks", "type": "{AvsAssessedDisk}"}, + "network_adapters": {"key": "networkAdapters", "type": "{AvsAssessedNetworkAdapter}"}, + "storage_in_use_gb": {"key": "storageInUseGB", "type": "float"}, + "suitability_explanation": {"key": "suitabilityExplanation", "type": "str"}, + "suitability_detail": {"key": "suitabilityDetail", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "boot_type": {"key": "bootType", "type": "str"}, + "operating_system_type": {"key": "operatingSystemType", "type": "str"}, + "operating_system_name": {"key": "operatingSystemName", "type": "str"}, + "operating_system_version": {"key": "operatingSystemVersion", "type": "str"}, + "operating_system_architecture": {"key": "operatingSystemArchitecture", "type": "str"}, + "created_timestamp": {"key": "createdTimestamp", "type": "iso-8601"}, + "updated_timestamp": {"key": "updatedTimestamp", "type": "iso-8601"}, + "display_name": {"key": "displayName", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "datacenter_machine_arm_id": {"key": "datacenterMachineArmId", "type": "str"}, + "datacenter_management_server_arm_id": {"key": "datacenterManagementServerArmId", "type": "str"}, + "datacenter_management_server_name": {"key": "datacenterManagementServerName", "type": "str"}, + "megabytes_of_memory": {"key": "megabytesOfMemory", "type": "float"}, + "number_of_cores": {"key": "numberOfCores", "type": "int"}, + "confidence_rating_in_percentage": {"key": "confidenceRatingInPercentage", "type": "float"}, + "percentage_cores_utilization": {"key": "percentageCoresUtilization", "type": "float"}, + "percentage_memory_utilization": {"key": "percentageMemoryUtilization", "type": "float"}, + "suitability": {"key": "suitability", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: # pylint: disable=too-many-locals + """ """ + super().__init__(**kwargs) + self.errors = None + self.disks = None + self.network_adapters = None + self.storage_in_use_gb = None + self.suitability_explanation = None + self.suitability_detail = None + self.type = None + self.boot_type = None + self.operating_system_type = None + self.operating_system_name = None + self.operating_system_version = None + self.operating_system_architecture = None + self.created_timestamp = None + self.updated_timestamp = None + self.display_name = None + self.description = None + self.datacenter_machine_arm_id = None + self.datacenter_management_server_arm_id = None + self.datacenter_management_server_name = None + self.megabytes_of_memory = None + self.number_of_cores = None + self.confidence_rating_in_percentage = None + self.percentage_cores_utilization = None + self.percentage_memory_utilization = None + self.suitability = None + + +class AvsAssessedNetworkAdapter(_serialization.Model): + """Second level object returned as part of AVS AssessedMachine REST resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar mac_address: Mac address of the NIC. + :vartype mac_address: str + :ivar ip_addresses: IP V4 addresses for the machine. + :vartype ip_addresses: list[str] + :ivar display_name: Gets the display name of the network adapter. + :vartype display_name: str + :ivar megabytes_per_second_received: Gets the Received data for Network Adapter in MB/s. + This value is + the percentile of historical data based on options selected in Assessment. + :vartype megabytes_per_second_received: float + :ivar megabytes_per_second_transmitted: Gets the Transmitted data for Network Adapter in MB/s. + This value + is the percentile of historical data based on options selected in Assessment. + :vartype megabytes_per_second_transmitted: float + """ + + _validation = { + "mac_address": {"readonly": True}, + "ip_addresses": {"readonly": True}, + "display_name": {"readonly": True}, + "megabytes_per_second_received": {"readonly": True}, + "megabytes_per_second_transmitted": {"readonly": True}, + } + + _attribute_map = { + "mac_address": {"key": "macAddress", "type": "str"}, + "ip_addresses": {"key": "ipAddresses", "type": "[str]"}, + "display_name": {"key": "displayName", "type": "str"}, + "megabytes_per_second_received": {"key": "megabytesPerSecondReceived", "type": "float"}, + "megabytes_per_second_transmitted": {"key": "megabytesPerSecondTransmitted", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.mac_address = None + self.ip_addresses = None + self.display_name = None + self.megabytes_per_second_received = None + self.megabytes_per_second_transmitted = None + + +class AvsAssessment(ProxyResource): + """AVS assessment 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.AvsAssessmentProperties + """ + + _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": "AvsAssessmentProperties"}, + } + + def __init__(self, *, properties: Optional["_models.AvsAssessmentProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.AvsAssessmentProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class AvsAssessmentListResult(_serialization.Model): + """The response of a AvsAssessment list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The AvsAssessment items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.AvsAssessment] + :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": "[AvsAssessment]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.AvsAssessment"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The AvsAssessment items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.AvsAssessment] + :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 AvsAssessmentOptions(ProxyResource): + """AVS Assessment options 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.AvsAssessmentOptionsProperties + """ + + _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": "AvsAssessmentOptionsProperties"}, + } + + def __init__(self, *, properties: Optional["_models.AvsAssessmentOptionsProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.AvsAssessmentOptionsProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class AvsAssessmentOptionsListResult(_serialization.Model): + """The response of a AvsAssessmentOptions list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The AvsAssessmentOptions items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.AvsAssessmentOptions] + :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": "[AvsAssessmentOptions]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.AvsAssessmentOptions"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The AvsAssessmentOptions items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.AvsAssessmentOptions] + :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 AvsAssessmentOptionsProperties(_serialization.Model): + """AVS Assessment options properties. + + :ivar avs_nodes: AVS SKU Nodes. + :vartype avs_nodes: list[~azure.mgmt.migrationassessment.models.AvsSkuOptions] + :ivar avs_external_storage_types: AVS External Storage Types Supported. + :vartype avs_external_storage_types: + list[~azure.mgmt.migrationassessment.models.AvsExternalStorageOptions] + :ivar failures_to_tolerate_and_raid_level_values: FTT and Raid level values. + :vartype failures_to_tolerate_and_raid_level_values: list[str or + ~azure.mgmt.migrationassessment.models.FttAndRaidLevel] + :ivar reserved_instance_avs_nodes: List of AVS nodes for RI. + :vartype reserved_instance_avs_nodes: list[str or + ~azure.mgmt.migrationassessment.models.AzureAvsNodeType] + :ivar reserved_instance_supported_locations: List of supported Azure regions for reserved + instances. + :vartype reserved_instance_supported_locations: list[str or + ~azure.mgmt.migrationassessment.models.AzureLocation] + :ivar reserved_instance_supported_currencies: List of supported currencies for reserved + instances. + :vartype reserved_instance_supported_currencies: list[str or + ~azure.mgmt.migrationassessment.models.AzureCurrency] + :ivar reserved_instance_supported_offers: List of supported Azure offer codes for reserved + instances. + :vartype reserved_instance_supported_offers: list[str or + ~azure.mgmt.migrationassessment.models.AzureOfferCode] + """ + + _attribute_map = { + "avs_nodes": {"key": "avsNodes", "type": "[AvsSkuOptions]"}, + "avs_external_storage_types": {"key": "avsExternalStorageTypes", "type": "[AvsExternalStorageOptions]"}, + "failures_to_tolerate_and_raid_level_values": {"key": "failuresToTolerateAndRaidLevelValues", "type": "[str]"}, + "reserved_instance_avs_nodes": {"key": "reservedInstanceAvsNodes", "type": "[str]"}, + "reserved_instance_supported_locations": {"key": "reservedInstanceSupportedLocations", "type": "[str]"}, + "reserved_instance_supported_currencies": {"key": "reservedInstanceSupportedCurrencies", "type": "[str]"}, + "reserved_instance_supported_offers": {"key": "reservedInstanceSupportedOffers", "type": "[str]"}, + } + + def __init__( + self, + *, + avs_nodes: Optional[List["_models.AvsSkuOptions"]] = None, + avs_external_storage_types: Optional[List["_models.AvsExternalStorageOptions"]] = None, + failures_to_tolerate_and_raid_level_values: Optional[List[Union[str, "_models.FttAndRaidLevel"]]] = None, + reserved_instance_avs_nodes: Optional[List[Union[str, "_models.AzureAvsNodeType"]]] = None, + reserved_instance_supported_locations: Optional[List[Union[str, "_models.AzureLocation"]]] = None, + reserved_instance_supported_currencies: Optional[List[Union[str, "_models.AzureCurrency"]]] = None, + reserved_instance_supported_offers: Optional[List[Union[str, "_models.AzureOfferCode"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword avs_nodes: AVS SKU Nodes. + :paramtype avs_nodes: list[~azure.mgmt.migrationassessment.models.AvsSkuOptions] + :keyword avs_external_storage_types: AVS External Storage Types Supported. + :paramtype avs_external_storage_types: + list[~azure.mgmt.migrationassessment.models.AvsExternalStorageOptions] + :keyword failures_to_tolerate_and_raid_level_values: FTT and Raid level values. + :paramtype failures_to_tolerate_and_raid_level_values: list[str or + ~azure.mgmt.migrationassessment.models.FttAndRaidLevel] + :keyword reserved_instance_avs_nodes: List of AVS nodes for RI. + :paramtype reserved_instance_avs_nodes: list[str or + ~azure.mgmt.migrationassessment.models.AzureAvsNodeType] + :keyword reserved_instance_supported_locations: List of supported Azure regions for reserved + instances. + :paramtype reserved_instance_supported_locations: list[str or + ~azure.mgmt.migrationassessment.models.AzureLocation] + :keyword reserved_instance_supported_currencies: List of supported currencies for reserved + instances. + :paramtype reserved_instance_supported_currencies: list[str or + ~azure.mgmt.migrationassessment.models.AzureCurrency] + :keyword reserved_instance_supported_offers: List of supported Azure offer codes for reserved + instances. + :paramtype reserved_instance_supported_offers: list[str or + ~azure.mgmt.migrationassessment.models.AzureOfferCode] + """ + super().__init__(**kwargs) + self.avs_nodes = avs_nodes + self.avs_external_storage_types = avs_external_storage_types + self.failures_to_tolerate_and_raid_level_values = failures_to_tolerate_and_raid_level_values + self.reserved_instance_avs_nodes = reserved_instance_avs_nodes + self.reserved_instance_supported_locations = reserved_instance_supported_locations + self.reserved_instance_supported_currencies = reserved_instance_supported_currencies + self.reserved_instance_supported_offers = reserved_instance_supported_offers + + +class AzureResourceProperties(_serialization.Model): + """Common properties for all azure tracked and proxy resources. + + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningState + """ + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, *, provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, **kwargs: Any + ) -> None: + """ + :keyword provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :paramtype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningState + """ + super().__init__(**kwargs) + self.provisioning_state = provisioning_state + + +class AvsAssessmentProperties(AzureResourceProperties): + """Properties of the AVS assessment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningState + :ivar assessment_error_summary: Gets the assessment error summary. + This is the number of machines + affected by each type of error in this assessment. + :vartype assessment_error_summary: dict[str, int] + :ivar failures_to_tolerate_and_raid_level: Failures to tolerate and RAID level in a common + property. Known values are: "Unknown", "Ftt1Raid1", "Ftt1Raid5", "Ftt2Raid1", "Ftt2Raid6", and + "Ftt3Raid1". + :vartype failures_to_tolerate_and_raid_level: str or + ~azure.mgmt.migrationassessment.models.FttAndRaidLevel + :ivar failures_to_tolerate_and_raid_level_list: List of Failures to tolerate and RAID levels in + a common property. + :vartype failures_to_tolerate_and_raid_level_list: list[str or + ~azure.mgmt.migrationassessment.models.FttAndRaidLevel] + :ivar vcpu_oversubscription: VCPU over subscription. + :vartype vcpu_oversubscription: float + :ivar node_type: AVS node type. Known values are: "Unknown", "AV36", "AV36P", "AV52", and + "AV64". + :vartype node_type: str or ~azure.mgmt.migrationassessment.models.AzureAvsNodeType + :ivar node_types: AVS node types. + :vartype node_types: list[str or ~azure.mgmt.migrationassessment.models.AzureAvsNodeType] + :ivar external_storage_types: List of AVS external storage types. + :vartype external_storage_types: list[str or + ~azure.mgmt.migrationassessment.models.ExternalStorageType] + :ivar avs_assessment_scenario: AVS Assessment Scenario. Known values are: "Unknown", + "NewAvsSddc", and "AvsSddcExpansion". + :vartype avs_assessment_scenario: str or + ~azure.mgmt.migrationassessment.models.AvsAssessmentScenario + :ivar is_vcf_byol_enabled: Is VCF license applied. + :vartype is_vcf_byol_enabled: bool + :ivar cost_components: collection of cost components. + :vartype cost_components: list[~azure.mgmt.migrationassessment.models.CostComponent] + :ivar reserved_instance: Reserved instance. Known values are: "None", "RI1Year", and "RI3Year". + :vartype reserved_instance: str or ~azure.mgmt.migrationassessment.models.AzureReservedInstance + :ivar total_monthly_cost: Total monthly cost. + :vartype total_monthly_cost: float + :ivar suitability: Gets or sets the Assessment cloud suitability. Known values are: "Unknown", + "NotSuitable", "Suitable", "ConditionallySuitable", and "ReadinessUnknown". + :vartype suitability: str or ~azure.mgmt.migrationassessment.models.CloudSuitability + :ivar suitability_explanation: Gets or sets the Assessment suitability explanation. Known + values are: "Unknown", "NotApplicable", "UnsupportedLocationForSelectedNode", + "InternalErrorInRecommendation", and "UnsupportedLocationForSelectedExternalStorageTypes". + :vartype suitability_explanation: str or + ~azure.mgmt.migrationassessment.models.AzureAvsSuitabilityExplanation + :ivar number_of_nodes: Recommended number of nodes. + :vartype number_of_nodes: int + :ivar cpu_utilization: Predicted CPU utilization. + :vartype cpu_utilization: float + :ivar ram_utilization: Predicted RAM utilization. + :vartype ram_utilization: float + :ivar storage_utilization: Predicted storage utilization. + :vartype storage_utilization: float + :ivar total_cpu_cores: Predicted total CPU cores used. + :vartype total_cpu_cores: float + :ivar total_ram_in_gb: Predicted total RAM used in GB. + :vartype total_ram_in_gb: float + :ivar total_storage_in_gb: Predicted total Storage used in GB. + :vartype total_storage_in_gb: float + :ivar avs_estimated_nodes: Estimated AVS SKU for Assessment. + :vartype avs_estimated_nodes: list[~azure.mgmt.migrationassessment.models.AvsEstimatedNode] + :ivar avs_estimated_external_storages: Estimated External Storage for Assessment. + :vartype avs_estimated_external_storages: + list[~azure.mgmt.migrationassessment.models.AvsEstimatedExternalStorage] + :ivar avs_estimated_networks: Estimated External Storage for Assessment. + :vartype avs_estimated_networks: + list[~azure.mgmt.migrationassessment.models.AvsEstimatedNetwork] + :ivar cpu_headroom: Percentage of CPU capacity reserved for processing additional workloads. + :vartype cpu_headroom: float + :ivar number_of_machines: Number of machines part of the assessment. + :vartype number_of_machines: int + :ivar suitability_summary: Cloud suitability summary for all the machines in the assessment. + :vartype suitability_summary: dict[str, int] + :ivar mem_overcommit: Memory overcommit. + :vartype mem_overcommit: float + :ivar dedupe_compression: De-duplication compression. + :vartype dedupe_compression: float + :ivar limiting_factor: Limiting factor. + :vartype limiting_factor: str + :ivar is_stretch_cluster_enabled: Is Stretch Cluster Enabled. + :vartype is_stretch_cluster_enabled: bool + :ivar group_type: Gets the group type for the assessment. Known values are: "Default", + "Import", and "Import". + :vartype group_type: str or ~azure.mgmt.migrationassessment.models.GroupType + :ivar assessment_type: Assessment type of the assessment. Known values are: "Unknown", + "MachineAssessment", "AvsAssessment", "SqlAssessment", and "WebAppAssessment". + :vartype assessment_type: str or ~azure.mgmt.migrationassessment.models.AssessmentType + :ivar azure_location: Azure Location or Azure region where to which the machines will be + migrated. Known values are: "Unknown", "EastAsia", "SoutheastAsia", "AustraliaEast", + "AustraliaSoutheast", "BrazilSouth", "CanadaCentral", "CanadaEast", "WestEurope", + "NorthEurope", "CentralIndia", "SouthIndia", "WestIndia", "JapanEast", "JapanWest", + "KoreaCentral", "KoreaSouth", "UkWest", "UkSouth", "NorthCentralUs", "EastUs", "WestUs2", + "SouthCentralUs", "CentralUs", "EastUs2", "WestUs", "WestCentralUs", "GermanyCentral", + "GermanyNortheast", "ChinaNorth", "ChinaEast", "USGovArizona", "USGovTexas", "USGovIowa", + "USGovVirginia", "USDoDCentral", "USDoDEast", "FranceCentral", "AustraliaCentral", + "SouthAfricaNorth", "FranceSouth", "AustraliaCentral2", "SouthAfricaWest", "GermanyNorth", + "GermanyWestCentral", "NorwayEast", "NorwayWest", "ChinaEast2", "ChinaNorth2", + "SwitzerlandNorth", "SwitzerlandWest", "UAENorth", "UAECentral", "UsNatEast", "UsNatWest", + "UsSecEast", "UsSecCentral", "UsSecWest", "SwedenCentral", and "QatarCentral". + :vartype azure_location: str or ~azure.mgmt.migrationassessment.models.AzureLocation + :ivar azure_offer_code: Azure Offer code according to which cost estimation is done. Known + values are: "Unknown", "MSAZR0003P", "MSAZR0044P", "MSAZR0059P", "MSAZR0060P", "MSAZR0062P", + "MSAZR0063P", "MSAZR0064P", "MSAZR0029P", "MSAZR0022P", "MSAZR0023P", "MSAZR0148P", + "MSAZR0025P", "MSAZR0036P", "MSAZR0120P", "MSAZR0121P", "MSAZR0122P", "MSAZR0123P", + "MSAZR0124P", "MSAZR0125P", "MSAZR0126P", "MSAZR0127P", "MSAZR0128P", "MSAZR0129P", + "MSAZR0130P", "MSAZR0111P", "MSAZR0144P", "MSAZR0149P", "MSMCAZR0044P", "MSMCAZR0059P", + "MSMCAZR0060P", "MSMCAZR0063P", "MSMCAZR0120P", "MSMCAZR0121P", "MSMCAZR0125P", "MSMCAZR0128P", + "MSAZRDE0003P", "MSAZRDE0044P", "MSAZRUSGOV0003P", "EA", "MSAZR0243P", "SavingsPlan1Year", and + "SavingsPlan3Year". + :vartype azure_offer_code: str or ~azure.mgmt.migrationassessment.models.AzureOfferCode + :ivar currency: Currency in which prices should be reported. Known values are: "Unknown", + "USD", "DKK", "CAD", "IDR", "JPY", "KRW", "NZD", "NOK", "RUB", "SAR", "ZAR", "SEK", "TRY", + "GBP", "MXN", "MYR", "INR", "HKD", "BRL", "TWD", "EUR", "CHF", "ARS", "AUD", "CNY", and "TRY". + :vartype currency: str or ~azure.mgmt.migrationassessment.models.AzureCurrency + :ivar scaling_factor: Percentage of buffer that user wants on performance metrics when + recommending + Azure sizes. + :vartype scaling_factor: float + :ivar percentile: Percentile of the utilization data values to be considered while assessing + machines. Known values are: "Percentile50", "Percentile90", "Percentile95", and + "Percentile99". + :vartype percentile: str or ~azure.mgmt.migrationassessment.models.Percentile + :ivar time_range: Time Range for which the historic utilization data should be considered for + assessment. Known values are: "Day", "Week", "Month", and "Custom". + :vartype time_range: str or ~azure.mgmt.migrationassessment.models.TimeRange + :ivar perf_data_start_time: Gets or sets the start time to consider performance data for + assessment. + :vartype perf_data_start_time: ~datetime.datetime + :ivar perf_data_end_time: Gets or sets the end time to consider performance data for + assessment. + :vartype perf_data_end_time: ~datetime.datetime + :ivar stage: User configurable setting to display the Stage of Assessment. Known values are: + "InProgress", "UnderReview", and "Approved". + :vartype stage: str or ~azure.mgmt.migrationassessment.models.AssessmentStage + :ivar discount_percentage: Custom discount percentage. + :vartype discount_percentage: float + :ivar sizing_criterion: Assessment sizing criterion. Known values are: "PerformanceBased" and + "AsOnPremises". + :vartype sizing_criterion: str or + ~azure.mgmt.migrationassessment.models.AssessmentSizingCriterion + :ivar confidence_rating_in_percentage: Confidence Rating in Percentage. + :vartype confidence_rating_in_percentage: float + :ivar prices_timestamp: Time when the Azure Prices were queried. Date-Time represented in + ISO-8601 + format. + :vartype prices_timestamp: ~datetime.datetime + :ivar created_timestamp: Date and Time when assessment was created. + :vartype created_timestamp: ~datetime.datetime + :ivar updated_timestamp: Date and Time when assessment was last updated. + :vartype updated_timestamp: ~datetime.datetime + :ivar status: Whether assessment is in valid state and all machines have been assessed. Known + values are: "Created", "Updated", "Running", "Completed", "Invalid", "OutOfSync", "OutDated", + and "Deleted". + :vartype status: str or ~azure.mgmt.migrationassessment.models.AssessmentStatus + :ivar schema_version: Schema version. + :vartype schema_version: str + """ + + _validation = { + "assessment_error_summary": {"readonly": True}, + "cost_components": {"readonly": True}, + "total_monthly_cost": {"readonly": True}, + "suitability": {"readonly": True}, + "suitability_explanation": {"readonly": True}, + "number_of_nodes": {"readonly": True}, + "cpu_utilization": {"readonly": True}, + "ram_utilization": {"readonly": True}, + "storage_utilization": {"readonly": True}, + "total_cpu_cores": {"readonly": True}, + "total_ram_in_gb": {"readonly": True}, + "total_storage_in_gb": {"readonly": True}, + "avs_estimated_nodes": {"readonly": True}, + "avs_estimated_external_storages": {"readonly": True}, + "avs_estimated_networks": {"readonly": True}, + "number_of_machines": {"readonly": True}, + "suitability_summary": {"readonly": True}, + "limiting_factor": {"readonly": True}, + "group_type": {"readonly": True}, + "assessment_type": {"readonly": True}, + "stage": {"readonly": True}, + "confidence_rating_in_percentage": {"readonly": True}, + "prices_timestamp": {"readonly": True}, + "created_timestamp": {"readonly": True}, + "updated_timestamp": {"readonly": True}, + "status": {"readonly": True}, + "schema_version": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "assessment_error_summary": {"key": "assessmentErrorSummary", "type": "{int}"}, + "failures_to_tolerate_and_raid_level": {"key": "failuresToTolerateAndRaidLevel", "type": "str"}, + "failures_to_tolerate_and_raid_level_list": {"key": "failuresToTolerateAndRaidLevelList", "type": "[str]"}, + "vcpu_oversubscription": {"key": "vcpuOversubscription", "type": "float"}, + "node_type": {"key": "nodeType", "type": "str"}, + "node_types": {"key": "nodeTypes", "type": "[str]"}, + "external_storage_types": {"key": "externalStorageTypes", "type": "[str]"}, + "avs_assessment_scenario": {"key": "avsAssessmentScenario", "type": "str"}, + "is_vcf_byol_enabled": {"key": "isVcfByolEnabled", "type": "bool"}, + "cost_components": {"key": "costComponents", "type": "[CostComponent]"}, + "reserved_instance": {"key": "reservedInstance", "type": "str"}, + "total_monthly_cost": {"key": "totalMonthlyCost", "type": "float"}, + "suitability": {"key": "suitability", "type": "str"}, + "suitability_explanation": {"key": "suitabilityExplanation", "type": "str"}, + "number_of_nodes": {"key": "numberOfNodes", "type": "int"}, + "cpu_utilization": {"key": "cpuUtilization", "type": "float"}, + "ram_utilization": {"key": "ramUtilization", "type": "float"}, + "storage_utilization": {"key": "storageUtilization", "type": "float"}, + "total_cpu_cores": {"key": "totalCpuCores", "type": "float"}, + "total_ram_in_gb": {"key": "totalRamInGB", "type": "float"}, + "total_storage_in_gb": {"key": "totalStorageInGB", "type": "float"}, + "avs_estimated_nodes": {"key": "avsEstimatedNodes", "type": "[AvsEstimatedNode]"}, + "avs_estimated_external_storages": { + "key": "avsEstimatedExternalStorages", + "type": "[AvsEstimatedExternalStorage]", + }, + "avs_estimated_networks": {"key": "avsEstimatedNetworks", "type": "[AvsEstimatedNetwork]"}, + "cpu_headroom": {"key": "cpuHeadroom", "type": "float"}, + "number_of_machines": {"key": "numberOfMachines", "type": "int"}, + "suitability_summary": {"key": "suitabilitySummary", "type": "{int}"}, + "mem_overcommit": {"key": "memOvercommit", "type": "float"}, + "dedupe_compression": {"key": "dedupeCompression", "type": "float"}, + "limiting_factor": {"key": "limitingFactor", "type": "str"}, + "is_stretch_cluster_enabled": {"key": "isStretchClusterEnabled", "type": "bool"}, + "group_type": {"key": "groupType", "type": "str"}, + "assessment_type": {"key": "assessmentType", "type": "str"}, + "azure_location": {"key": "azureLocation", "type": "str"}, + "azure_offer_code": {"key": "azureOfferCode", "type": "str"}, + "currency": {"key": "currency", "type": "str"}, + "scaling_factor": {"key": "scalingFactor", "type": "float"}, + "percentile": {"key": "percentile", "type": "str"}, + "time_range": {"key": "timeRange", "type": "str"}, + "perf_data_start_time": {"key": "perfDataStartTime", "type": "iso-8601"}, + "perf_data_end_time": {"key": "perfDataEndTime", "type": "iso-8601"}, + "stage": {"key": "stage", "type": "str"}, + "discount_percentage": {"key": "discountPercentage", "type": "float"}, + "sizing_criterion": {"key": "sizingCriterion", "type": "str"}, + "confidence_rating_in_percentage": {"key": "confidenceRatingInPercentage", "type": "float"}, + "prices_timestamp": {"key": "pricesTimestamp", "type": "iso-8601"}, + "created_timestamp": {"key": "createdTimestamp", "type": "iso-8601"}, + "updated_timestamp": {"key": "updatedTimestamp", "type": "iso-8601"}, + "status": {"key": "status", "type": "str"}, + "schema_version": {"key": "schemaVersion", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, + failures_to_tolerate_and_raid_level: Optional[Union[str, "_models.FttAndRaidLevel"]] = None, + failures_to_tolerate_and_raid_level_list: Optional[List[Union[str, "_models.FttAndRaidLevel"]]] = None, + vcpu_oversubscription: Optional[float] = None, + node_type: Optional[Union[str, "_models.AzureAvsNodeType"]] = None, + node_types: Optional[List[Union[str, "_models.AzureAvsNodeType"]]] = None, + external_storage_types: Optional[List[Union[str, "_models.ExternalStorageType"]]] = None, + avs_assessment_scenario: Optional[Union[str, "_models.AvsAssessmentScenario"]] = None, + is_vcf_byol_enabled: Optional[bool] = None, + reserved_instance: Optional[Union[str, "_models.AzureReservedInstance"]] = None, + cpu_headroom: Optional[float] = None, + mem_overcommit: Optional[float] = None, + dedupe_compression: Optional[float] = None, + is_stretch_cluster_enabled: Optional[bool] = None, + azure_location: Optional[Union[str, "_models.AzureLocation"]] = None, + azure_offer_code: Optional[Union[str, "_models.AzureOfferCode"]] = None, + currency: Optional[Union[str, "_models.AzureCurrency"]] = None, + scaling_factor: Optional[float] = None, + percentile: Optional[Union[str, "_models.Percentile"]] = None, + time_range: Optional[Union[str, "_models.TimeRange"]] = None, + perf_data_start_time: Optional[datetime.datetime] = None, + perf_data_end_time: Optional[datetime.datetime] = None, + discount_percentage: Optional[float] = None, + sizing_criterion: Optional[Union[str, "_models.AssessmentSizingCriterion"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :paramtype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningState + :keyword failures_to_tolerate_and_raid_level: Failures to tolerate and RAID level in a common + property. Known values are: "Unknown", "Ftt1Raid1", "Ftt1Raid5", "Ftt2Raid1", "Ftt2Raid6", and + "Ftt3Raid1". + :paramtype failures_to_tolerate_and_raid_level: str or + ~azure.mgmt.migrationassessment.models.FttAndRaidLevel + :keyword failures_to_tolerate_and_raid_level_list: List of Failures to tolerate and RAID levels + in a common property. + :paramtype failures_to_tolerate_and_raid_level_list: list[str or + ~azure.mgmt.migrationassessment.models.FttAndRaidLevel] + :keyword vcpu_oversubscription: VCPU over subscription. + :paramtype vcpu_oversubscription: float + :keyword node_type: AVS node type. Known values are: "Unknown", "AV36", "AV36P", "AV52", and + "AV64". + :paramtype node_type: str or ~azure.mgmt.migrationassessment.models.AzureAvsNodeType + :keyword node_types: AVS node types. + :paramtype node_types: list[str or ~azure.mgmt.migrationassessment.models.AzureAvsNodeType] + :keyword external_storage_types: List of AVS external storage types. + :paramtype external_storage_types: list[str or + ~azure.mgmt.migrationassessment.models.ExternalStorageType] + :keyword avs_assessment_scenario: AVS Assessment Scenario. Known values are: "Unknown", + "NewAvsSddc", and "AvsSddcExpansion". + :paramtype avs_assessment_scenario: str or + ~azure.mgmt.migrationassessment.models.AvsAssessmentScenario + :keyword is_vcf_byol_enabled: Is VCF license applied. + :paramtype is_vcf_byol_enabled: bool + :keyword reserved_instance: Reserved instance. Known values are: "None", "RI1Year", and + "RI3Year". + :paramtype reserved_instance: str or + ~azure.mgmt.migrationassessment.models.AzureReservedInstance + :keyword cpu_headroom: Percentage of CPU capacity reserved for processing additional workloads. + :paramtype cpu_headroom: float + :keyword mem_overcommit: Memory overcommit. + :paramtype mem_overcommit: float + :keyword dedupe_compression: De-duplication compression. + :paramtype dedupe_compression: float + :keyword is_stretch_cluster_enabled: Is Stretch Cluster Enabled. + :paramtype is_stretch_cluster_enabled: bool + :keyword azure_location: Azure Location or Azure region where to which the machines will be + migrated. Known values are: "Unknown", "EastAsia", "SoutheastAsia", "AustraliaEast", + "AustraliaSoutheast", "BrazilSouth", "CanadaCentral", "CanadaEast", "WestEurope", + "NorthEurope", "CentralIndia", "SouthIndia", "WestIndia", "JapanEast", "JapanWest", + "KoreaCentral", "KoreaSouth", "UkWest", "UkSouth", "NorthCentralUs", "EastUs", "WestUs2", + "SouthCentralUs", "CentralUs", "EastUs2", "WestUs", "WestCentralUs", "GermanyCentral", + "GermanyNortheast", "ChinaNorth", "ChinaEast", "USGovArizona", "USGovTexas", "USGovIowa", + "USGovVirginia", "USDoDCentral", "USDoDEast", "FranceCentral", "AustraliaCentral", + "SouthAfricaNorth", "FranceSouth", "AustraliaCentral2", "SouthAfricaWest", "GermanyNorth", + "GermanyWestCentral", "NorwayEast", "NorwayWest", "ChinaEast2", "ChinaNorth2", + "SwitzerlandNorth", "SwitzerlandWest", "UAENorth", "UAECentral", "UsNatEast", "UsNatWest", + "UsSecEast", "UsSecCentral", "UsSecWest", "SwedenCentral", and "QatarCentral". + :paramtype azure_location: str or ~azure.mgmt.migrationassessment.models.AzureLocation + :keyword azure_offer_code: Azure Offer code according to which cost estimation is done. Known + values are: "Unknown", "MSAZR0003P", "MSAZR0044P", "MSAZR0059P", "MSAZR0060P", "MSAZR0062P", + "MSAZR0063P", "MSAZR0064P", "MSAZR0029P", "MSAZR0022P", "MSAZR0023P", "MSAZR0148P", + "MSAZR0025P", "MSAZR0036P", "MSAZR0120P", "MSAZR0121P", "MSAZR0122P", "MSAZR0123P", + "MSAZR0124P", "MSAZR0125P", "MSAZR0126P", "MSAZR0127P", "MSAZR0128P", "MSAZR0129P", + "MSAZR0130P", "MSAZR0111P", "MSAZR0144P", "MSAZR0149P", "MSMCAZR0044P", "MSMCAZR0059P", + "MSMCAZR0060P", "MSMCAZR0063P", "MSMCAZR0120P", "MSMCAZR0121P", "MSMCAZR0125P", "MSMCAZR0128P", + "MSAZRDE0003P", "MSAZRDE0044P", "MSAZRUSGOV0003P", "EA", "MSAZR0243P", "SavingsPlan1Year", and + "SavingsPlan3Year". + :paramtype azure_offer_code: str or ~azure.mgmt.migrationassessment.models.AzureOfferCode + :keyword currency: Currency in which prices should be reported. Known values are: "Unknown", + "USD", "DKK", "CAD", "IDR", "JPY", "KRW", "NZD", "NOK", "RUB", "SAR", "ZAR", "SEK", "TRY", + "GBP", "MXN", "MYR", "INR", "HKD", "BRL", "TWD", "EUR", "CHF", "ARS", "AUD", "CNY", and "TRY". + :paramtype currency: str or ~azure.mgmt.migrationassessment.models.AzureCurrency + :keyword scaling_factor: Percentage of buffer that user wants on performance metrics when + recommending + Azure sizes. + :paramtype scaling_factor: float + :keyword percentile: Percentile of the utilization data values to be considered while assessing + machines. Known values are: "Percentile50", "Percentile90", "Percentile95", and + "Percentile99". + :paramtype percentile: str or ~azure.mgmt.migrationassessment.models.Percentile + :keyword time_range: Time Range for which the historic utilization data should be considered + for + assessment. Known values are: "Day", "Week", "Month", and "Custom". + :paramtype time_range: str or ~azure.mgmt.migrationassessment.models.TimeRange + :keyword perf_data_start_time: Gets or sets the start time to consider performance data for + assessment. + :paramtype perf_data_start_time: ~datetime.datetime + :keyword perf_data_end_time: Gets or sets the end time to consider performance data for + assessment. + :paramtype perf_data_end_time: ~datetime.datetime + :keyword discount_percentage: Custom discount percentage. + :paramtype discount_percentage: float + :keyword sizing_criterion: Assessment sizing criterion. Known values are: "PerformanceBased" + and "AsOnPremises". + :paramtype sizing_criterion: str or + ~azure.mgmt.migrationassessment.models.AssessmentSizingCriterion + """ + super().__init__(provisioning_state=provisioning_state, **kwargs) + self.assessment_error_summary = None + self.failures_to_tolerate_and_raid_level = failures_to_tolerate_and_raid_level + self.failures_to_tolerate_and_raid_level_list = failures_to_tolerate_and_raid_level_list + self.vcpu_oversubscription = vcpu_oversubscription + self.node_type = node_type + self.node_types = node_types + self.external_storage_types = external_storage_types + self.avs_assessment_scenario = avs_assessment_scenario + self.is_vcf_byol_enabled = is_vcf_byol_enabled + self.cost_components = None + self.reserved_instance = reserved_instance + self.total_monthly_cost = None + self.suitability = None + self.suitability_explanation = None + self.number_of_nodes = None + self.cpu_utilization = None + self.ram_utilization = None + self.storage_utilization = None + self.total_cpu_cores = None + self.total_ram_in_gb = None + self.total_storage_in_gb = None + self.avs_estimated_nodes = None + self.avs_estimated_external_storages = None + self.avs_estimated_networks = None + self.cpu_headroom = cpu_headroom + self.number_of_machines = None + self.suitability_summary = None + self.mem_overcommit = mem_overcommit + self.dedupe_compression = dedupe_compression + self.limiting_factor = None + self.is_stretch_cluster_enabled = is_stretch_cluster_enabled + self.group_type = None + self.assessment_type = None + self.azure_location = azure_location + self.azure_offer_code = azure_offer_code + self.currency = currency + self.scaling_factor = scaling_factor + self.percentile = percentile + self.time_range = time_range + self.perf_data_start_time = perf_data_start_time + self.perf_data_end_time = perf_data_end_time + self.stage = None + self.discount_percentage = discount_percentage + self.sizing_criterion = sizing_criterion + self.confidence_rating_in_percentage = None + self.prices_timestamp = None + self.created_timestamp = None + self.updated_timestamp = None + self.status = None + self.schema_version = None + + +class AvsEstimatedExternalStorage(_serialization.Model): + """Details on the Estimated External Storage for AVS Assessment. + + :ivar monthly_price: Total monthly cost for type of storage. + :vartype monthly_price: float + :ivar storage_type: Recommended External Storage. Known values are: "Unknown", "None", + "AnfStandard", "AnfPremium", and "AnfUltra". + :vartype storage_type: str or ~azure.mgmt.migrationassessment.models.ExternalStorageType + :ivar total_storage_in_gb: Predicted total Storage used in GB. + :vartype total_storage_in_gb: float + :ivar storage_utilization: Predicted storage utilization. + :vartype storage_utilization: float + """ + + _attribute_map = { + "monthly_price": {"key": "monthlyPrice", "type": "float"}, + "storage_type": {"key": "storageType", "type": "str"}, + "total_storage_in_gb": {"key": "totalStorageInGB", "type": "float"}, + "storage_utilization": {"key": "storageUtilization", "type": "float"}, + } + + def __init__( + self, + *, + monthly_price: Optional[float] = None, + storage_type: Optional[Union[str, "_models.ExternalStorageType"]] = None, + total_storage_in_gb: Optional[float] = None, + storage_utilization: Optional[float] = None, + **kwargs: Any + ) -> None: + """ + :keyword monthly_price: Total monthly cost for type of storage. + :paramtype monthly_price: float + :keyword storage_type: Recommended External Storage. Known values are: "Unknown", "None", + "AnfStandard", "AnfPremium", and "AnfUltra". + :paramtype storage_type: str or ~azure.mgmt.migrationassessment.models.ExternalStorageType + :keyword total_storage_in_gb: Predicted total Storage used in GB. + :paramtype total_storage_in_gb: float + :keyword storage_utilization: Predicted storage utilization. + :paramtype storage_utilization: float + """ + super().__init__(**kwargs) + self.monthly_price = monthly_price + self.storage_type = storage_type + self.total_storage_in_gb = total_storage_in_gb + self.storage_utilization = storage_utilization + + +class AvsEstimatedNetwork(_serialization.Model): + """Details on the Estimated Network Costs for AVS Assessment. + + :ivar monthly_price: Monthly cost for network type. + :vartype monthly_price: float + :ivar network_type: Recommended Network Sku. Known values are: "Unknown", "None", and + "ExpressRouteUltra". + :vartype network_type: str or ~azure.mgmt.migrationassessment.models.NetworkSkuType + """ + + _attribute_map = { + "monthly_price": {"key": "monthlyPrice", "type": "float"}, + "network_type": {"key": "networkType", "type": "str"}, + } + + def __init__( + self, + *, + monthly_price: Optional[float] = None, + network_type: Optional[Union[str, "_models.NetworkSkuType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword monthly_price: Monthly cost for network type. + :paramtype monthly_price: float + :keyword network_type: Recommended Network Sku. Known values are: "Unknown", "None", and + "ExpressRouteUltra". + :paramtype network_type: str or ~azure.mgmt.migrationassessment.models.NetworkSkuType + """ + super().__init__(**kwargs) + self.monthly_price = monthly_price + self.network_type = network_type + + +class AvsEstimatedNode(_serialization.Model): + """Details on the Estimated nodes for AVS Assessment. + + :ivar monthly_price: Total monthly cost for type and number of nodes. + :vartype monthly_price: float + :ivar node_type: Recommended SKU. Known values are: "Unknown", "AV36", "AV36P", "AV52", and + "AV64". + :vartype node_type: str or ~azure.mgmt.migrationassessment.models.AzureAvsNodeType + :ivar node_number: Number of nodes that will be needed. + :vartype node_number: int + :ivar cpu_utilization: Predicted CPU utilization. + :vartype cpu_utilization: float + :ivar ram_utilization: Predicted RAM utilization. + :vartype ram_utilization: float + :ivar storage_utilization: Predicted storage utilization. + :vartype storage_utilization: float + :ivar total_cpu: Predicted total CPU cores across the set of nodes. + :vartype total_cpu: float + :ivar total_ram: Predicted total RAM used in GB. + :vartype total_ram: float + :ivar total_storage: Predicted total Storage used in GB. + :vartype total_storage: float + :ivar pricing_model: Pricing model indicates what hour multiplier to use while estimating the + Nodes cost. Known values are: "None", "RI1Year", and "RI3Year". + :vartype pricing_model: str or ~azure.mgmt.migrationassessment.models.AzureReservedInstance + :ivar ftt_raid_level: FttRaidLevel recommended for Node. Known values are: "Unknown", + "Ftt1Raid1", "Ftt1Raid5", "Ftt2Raid1", "Ftt2Raid6", and "Ftt3Raid1". + :vartype ftt_raid_level: str or ~azure.mgmt.migrationassessment.models.FttAndRaidLevel + """ + + _attribute_map = { + "monthly_price": {"key": "monthlyPrice", "type": "float"}, + "node_type": {"key": "nodeType", "type": "str"}, + "node_number": {"key": "nodeNumber", "type": "int"}, + "cpu_utilization": {"key": "cpuUtilization", "type": "float"}, + "ram_utilization": {"key": "ramUtilization", "type": "float"}, + "storage_utilization": {"key": "storageUtilization", "type": "float"}, + "total_cpu": {"key": "totalCpu", "type": "float"}, + "total_ram": {"key": "totalRam", "type": "float"}, + "total_storage": {"key": "totalStorage", "type": "float"}, + "pricing_model": {"key": "pricingModel", "type": "str"}, + "ftt_raid_level": {"key": "fttRaidLevel", "type": "str"}, + } + + def __init__( + self, + *, + monthly_price: Optional[float] = None, + node_type: Optional[Union[str, "_models.AzureAvsNodeType"]] = None, + node_number: Optional[int] = None, + cpu_utilization: Optional[float] = None, + ram_utilization: Optional[float] = None, + storage_utilization: Optional[float] = None, + total_cpu: Optional[float] = None, + total_ram: Optional[float] = None, + total_storage: Optional[float] = None, + pricing_model: Optional[Union[str, "_models.AzureReservedInstance"]] = None, + ftt_raid_level: Optional[Union[str, "_models.FttAndRaidLevel"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword monthly_price: Total monthly cost for type and number of nodes. + :paramtype monthly_price: float + :keyword node_type: Recommended SKU. Known values are: "Unknown", "AV36", "AV36P", "AV52", and + "AV64". + :paramtype node_type: str or ~azure.mgmt.migrationassessment.models.AzureAvsNodeType + :keyword node_number: Number of nodes that will be needed. + :paramtype node_number: int + :keyword cpu_utilization: Predicted CPU utilization. + :paramtype cpu_utilization: float + :keyword ram_utilization: Predicted RAM utilization. + :paramtype ram_utilization: float + :keyword storage_utilization: Predicted storage utilization. + :paramtype storage_utilization: float + :keyword total_cpu: Predicted total CPU cores across the set of nodes. + :paramtype total_cpu: float + :keyword total_ram: Predicted total RAM used in GB. + :paramtype total_ram: float + :keyword total_storage: Predicted total Storage used in GB. + :paramtype total_storage: float + :keyword pricing_model: Pricing model indicates what hour multiplier to use while estimating + the Nodes cost. Known values are: "None", "RI1Year", and "RI3Year". + :paramtype pricing_model: str or ~azure.mgmt.migrationassessment.models.AzureReservedInstance + :keyword ftt_raid_level: FttRaidLevel recommended for Node. Known values are: "Unknown", + "Ftt1Raid1", "Ftt1Raid5", "Ftt2Raid1", "Ftt2Raid6", and "Ftt3Raid1". + :paramtype ftt_raid_level: str or ~azure.mgmt.migrationassessment.models.FttAndRaidLevel + """ + super().__init__(**kwargs) + self.monthly_price = monthly_price + self.node_type = node_type + self.node_number = node_number + self.cpu_utilization = cpu_utilization + self.ram_utilization = ram_utilization + self.storage_utilization = storage_utilization + self.total_cpu = total_cpu + self.total_ram = total_ram + self.total_storage = total_storage + self.pricing_model = pricing_model + self.ftt_raid_level = ftt_raid_level + + +class AvsExternalStorageOptions(_serialization.Model): + """AVS External Storage specific options. + + :ivar storage_type: AVS external storage type. Known values are: "Unknown", "None", + "AnfStandard", "AnfPremium", and "AnfUltra". + :vartype storage_type: str or ~azure.mgmt.migrationassessment.models.ExternalStorageType + :ivar target_locations: List of locations where this storage type is available. + :vartype target_locations: list[str or ~azure.mgmt.migrationassessment.models.AzureLocation] + """ + + _attribute_map = { + "storage_type": {"key": "storageType", "type": "str"}, + "target_locations": {"key": "targetLocations", "type": "[str]"}, + } + + def __init__( + self, + *, + storage_type: Optional[Union[str, "_models.ExternalStorageType"]] = None, + target_locations: Optional[List[Union[str, "_models.AzureLocation"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword storage_type: AVS external storage type. Known values are: "Unknown", "None", + "AnfStandard", "AnfPremium", and "AnfUltra". + :paramtype storage_type: str or ~azure.mgmt.migrationassessment.models.ExternalStorageType + :keyword target_locations: List of locations where this storage type is available. + :paramtype target_locations: list[str or ~azure.mgmt.migrationassessment.models.AzureLocation] + """ + super().__init__(**kwargs) + self.storage_type = storage_type + self.target_locations = target_locations + + +class AvsNodeSummary(_serialization.Model): + """Azure Avs Node summary. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar servers_suitable_for_migration: Servers suitable for migration. + :vartype servers_suitable_for_migration: int + :ivar total_number_of_servers: The total number of servers. + :vartype total_number_of_servers: int + :ivar cores: The total number of Avs VM cores. + :vartype cores: int + :ivar memory_gb: The total memory in GB. + :vartype memory_gb: float + :ivar avs_node_cost_details: The on premises PaaS cost. + :vartype avs_node_cost_details: ~azure.mgmt.migrationassessment.models.CostDetails + :ivar estimated_cost: Estimated cost. + :vartype estimated_cost: float + :ivar os_licensing_cost: OS licensing cost. + :vartype os_licensing_cost: float + :ivar estimated_cost_by_recommended_offer: Estimated cost by offer. + :vartype estimated_cost_by_recommended_offer: + list[~azure.mgmt.migrationassessment.models.EstimatedCostByOffer] + :ivar recommended_avs_node_type_summary: The recommended VM family summary. + :vartype recommended_avs_node_type_summary: + list[~azure.mgmt.migrationassessment.models.RecommendedAvsNodeTypeSummary] + :ivar estimated_external_storage: Estimated External Storage. + :vartype estimated_external_storage: + list[~azure.mgmt.migrationassessment.models.EstimatedExternalStorage] + :ivar estimated_network: Estimated Network. + :vartype estimated_network: list[~azure.mgmt.migrationassessment.models.EstimatedNetwork] + :ivar estimated_cost_with_vcf_byol: Estimated Cost With VCF BYOL. + :vartype estimated_cost_with_vcf_byol: float + :ivar errors: Represents errors which might have occurred while calculating AVS Node Summary. + :vartype errors: list[~azure.mgmt.migrationassessment.models.ErrorDetailAutoGenerated] + """ + + _validation = { + "servers_suitable_for_migration": {"readonly": True}, + "total_number_of_servers": {"readonly": True}, + "cores": {"readonly": True}, + "memory_gb": {"readonly": True}, + "avs_node_cost_details": {"readonly": True}, + "estimated_cost": {"readonly": True}, + "os_licensing_cost": {"readonly": True}, + "estimated_cost_by_recommended_offer": {"readonly": True}, + "recommended_avs_node_type_summary": {"readonly": True}, + "estimated_external_storage": {"readonly": True}, + "estimated_network": {"readonly": True}, + "estimated_cost_with_vcf_byol": {"readonly": True}, + "errors": {"readonly": True}, + } + + _attribute_map = { + "servers_suitable_for_migration": {"key": "serversSuitableForMigration", "type": "int"}, + "total_number_of_servers": {"key": "totalNumberOfServers", "type": "int"}, + "cores": {"key": "cores", "type": "int"}, + "memory_gb": {"key": "memoryGb", "type": "float"}, + "avs_node_cost_details": {"key": "avsNodeCostDetails", "type": "CostDetails"}, + "estimated_cost": {"key": "estimatedCost", "type": "float"}, + "os_licensing_cost": {"key": "osLicensingCost", "type": "float"}, + "estimated_cost_by_recommended_offer": { + "key": "estimatedCostByRecommendedOffer", + "type": "[EstimatedCostByOffer]", + }, + "recommended_avs_node_type_summary": { + "key": "recommendedAvsNodeTypeSummary", + "type": "[RecommendedAvsNodeTypeSummary]", + }, + "estimated_external_storage": {"key": "estimatedExternalStorage", "type": "[EstimatedExternalStorage]"}, + "estimated_network": {"key": "estimatedNetwork", "type": "[EstimatedNetwork]"}, + "estimated_cost_with_vcf_byol": {"key": "estimatedCostWithVcfByol", "type": "float"}, + "errors": {"key": "errors", "type": "[ErrorDetailAutoGenerated]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.servers_suitable_for_migration = None + self.total_number_of_servers = None + self.cores = None + self.memory_gb = None + self.avs_node_cost_details = None + self.estimated_cost = None + self.os_licensing_cost = None + self.estimated_cost_by_recommended_offer = None + self.recommended_avs_node_type_summary = None + self.estimated_external_storage = None + self.estimated_network = None + self.estimated_cost_with_vcf_byol = None + self.errors = None + + +class AvsSkuOptions(_serialization.Model): + """AVS SKU specific options. + + :ivar node_type: AVS Node type. Known values are: "Unknown", "AV36", "AV36P", "AV52", and + "AV64". + :vartype node_type: str or ~azure.mgmt.migrationassessment.models.AzureAvsNodeType + :ivar target_locations: List of locations where this node type is available. + :vartype target_locations: list[str or ~azure.mgmt.migrationassessment.models.AzureLocation] + """ + + _attribute_map = { + "node_type": {"key": "nodeType", "type": "str"}, + "target_locations": {"key": "targetLocations", "type": "[str]"}, + } + + def __init__( + self, + *, + node_type: Optional[Union[str, "_models.AzureAvsNodeType"]] = None, + target_locations: Optional[List[Union[str, "_models.AzureLocation"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword node_type: AVS Node type. Known values are: "Unknown", "AV36", "AV36P", "AV52", and + "AV64". + :paramtype node_type: str or ~azure.mgmt.migrationassessment.models.AzureAvsNodeType + :keyword target_locations: List of locations where this node type is available. + :paramtype target_locations: list[str or ~azure.mgmt.migrationassessment.models.AzureLocation] + """ + super().__init__(**kwargs) + self.node_type = node_type + self.target_locations = target_locations + + +class AvsSummary(ProxyResource): + """Avs summary REST 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.AvsSummaryProperties + """ + + _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": "AvsSummaryProperties"}, + } + + def __init__(self, *, properties: Optional["_models.AvsSummaryProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.AvsSummaryProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class AvsSummaryListResult(_serialization.Model): + """The response of a AvsSummary list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The AvsSummary items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.AvsSummary] + :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": "[AvsSummary]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.AvsSummary"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The AvsSummary items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.AvsSummary] + :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 AvsSummaryProperties(_serialization.Model): + """Avs summary properties class. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar azure_avs_summary: The Azure Avs summary. + :vartype azure_avs_summary: ~azure.mgmt.migrationassessment.models.AzureAvsSummary + :ivar on_premises_avs_summary: The on premises IaaS summary. + :vartype on_premises_avs_summary: ~azure.mgmt.migrationassessment.models.OnPremisesIaasSummary + """ + + _validation = { + "azure_avs_summary": {"readonly": True}, + "on_premises_avs_summary": {"readonly": True}, + } + + _attribute_map = { + "azure_avs_summary": {"key": "azureAvsSummary", "type": "AzureAvsSummary"}, + "on_premises_avs_summary": {"key": "onPremisesAvsSummary", "type": "OnPremisesIaasSummary"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.azure_avs_summary = None + self.on_premises_avs_summary = None + + +class AzureAppServiceContainerSummary(_serialization.Model): + """Shows Azure App Service Container summary. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar estimated_cost_by_offer: Estimated cost by recommendation offer. + :vartype estimated_cost_by_offer: + list[~azure.mgmt.migrationassessment.models.EstimatedCostByOffer] + :ivar distribution_by_sku: Distribution by SKU. + :vartype distribution_by_sku: list[~azure.mgmt.migrationassessment.models.WebAppTargetSku] + :ivar distribution_by_app: Distribution by application type. + :vartype distribution_by_app: list[~azure.mgmt.migrationassessment.models.WebAppDistribution] + """ + + _validation = { + "estimated_cost_by_offer": {"readonly": True}, + "distribution_by_sku": {"readonly": True}, + "distribution_by_app": {"readonly": True}, + } + + _attribute_map = { + "estimated_cost_by_offer": {"key": "estimatedCostByOffer", "type": "[EstimatedCostByOffer]"}, + "distribution_by_sku": {"key": "distributionBySku", "type": "[WebAppTargetSku]"}, + "distribution_by_app": {"key": "distributionByApp", "type": "[WebAppDistribution]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.estimated_cost_by_offer = None + self.distribution_by_sku = None + self.distribution_by_app = None + + +class AzureAppServiceSummary(_serialization.Model): + """Shows Azure App Service summary. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar estimated_cost_by_offer: Estimated cost by recommendation offer. + :vartype estimated_cost_by_offer: + list[~azure.mgmt.migrationassessment.models.EstimatedCostByOffer] + :ivar distribution_by_sku: Distribution by SKU. + :vartype distribution_by_sku: list[~azure.mgmt.migrationassessment.models.AppServiceSku] + :ivar distribution_by_app: Distribution by application type. + :vartype distribution_by_app: list[~azure.mgmt.migrationassessment.models.WebAppDistribution] + """ + + _validation = { + "estimated_cost_by_offer": {"readonly": True}, + "distribution_by_sku": {"readonly": True}, + "distribution_by_app": {"readonly": True}, + } + + _attribute_map = { + "estimated_cost_by_offer": {"key": "estimatedCostByOffer", "type": "[EstimatedCostByOffer]"}, + "distribution_by_sku": {"key": "distributionBySku", "type": "[AppServiceSku]"}, + "distribution_by_app": {"key": "distributionByApp", "type": "[WebAppDistribution]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.estimated_cost_by_offer = None + self.distribution_by_sku = None + self.distribution_by_app = None + + +class AzureArcManagementSettings(_serialization.Model): + """Azure Arc Management settings. + + All required parameters must be populated in order to send to server. + + :ivar monitoring_settings: Gets the azure arc monitoring settings. Required. + :vartype monitoring_settings: ~azure.mgmt.migrationassessment.models.AzureArcMonitoringSettings + """ + + _validation = { + "monitoring_settings": {"required": True}, + } + + _attribute_map = { + "monitoring_settings": {"key": "monitoringSettings", "type": "AzureArcMonitoringSettings"}, + } + + def __init__(self, *, monitoring_settings: "_models.AzureArcMonitoringSettings", **kwargs: Any) -> None: + """ + :keyword monitoring_settings: Gets the azure arc monitoring settings. Required. + :paramtype monitoring_settings: + ~azure.mgmt.migrationassessment.models.AzureArcMonitoringSettings + """ + super().__init__(**kwargs) + self.monitoring_settings = monitoring_settings + + +class AzureArcMonitoringSettings(_serialization.Model): + """Azure Arc Monitoring settings. + + All required parameters must be populated in order to send to server. + + :ivar logs_volume_in_gb: Logs volume settings. Required. + :vartype logs_volume_in_gb: float + :ivar alert_rules_count: Number of alert rules settings. Required. + :vartype alert_rules_count: int + """ + + _validation = { + "logs_volume_in_gb": {"required": True}, + "alert_rules_count": {"required": True}, + } + + _attribute_map = { + "logs_volume_in_gb": {"key": "logsVolumeInGB", "type": "float"}, + "alert_rules_count": {"key": "alertRulesCount", "type": "int"}, + } + + def __init__(self, *, logs_volume_in_gb: float, alert_rules_count: int, **kwargs: Any) -> None: + """ + :keyword logs_volume_in_gb: Logs volume settings. Required. + :paramtype logs_volume_in_gb: float + :keyword alert_rules_count: Number of alert rules settings. Required. + :paramtype alert_rules_count: int + """ + super().__init__(**kwargs) + self.logs_volume_in_gb = logs_volume_in_gb + self.alert_rules_count = alert_rules_count + + +class AzureArcSettings(_serialization.Model): + """Azure arc settings for a business case. + + All required parameters must be populated in order to send to server. + + :ivar azure_arc_state: AzureArc state indicates whether to include azure arc related costs in + on-premises or not. Required. Known values are: "Disabled", "Enabled", and "Unknown". + :vartype azure_arc_state: str or ~azure.mgmt.migrationassessment.models.AzureArcState + :ivar labor_cost_percentage: Gets Azure arc labour cost percentage. + :vartype labor_cost_percentage: float + :ivar management_settings: Management settings. + :vartype management_settings: ~azure.mgmt.migrationassessment.models.AzureArcManagementSettings + """ + + _validation = { + "azure_arc_state": {"required": True}, + "labor_cost_percentage": {"maximum": 100, "minimum": 0}, + } + + _attribute_map = { + "azure_arc_state": {"key": "azureArcState", "type": "str"}, + "labor_cost_percentage": {"key": "laborCostPercentage", "type": "float"}, + "management_settings": {"key": "managementSettings", "type": "AzureArcManagementSettings"}, + } + + def __init__( + self, + *, + azure_arc_state: Union[str, "_models.AzureArcState"], + labor_cost_percentage: Optional[float] = None, + management_settings: Optional["_models.AzureArcManagementSettings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword azure_arc_state: AzureArc state indicates whether to include azure arc related costs + in on-premises or not. Required. Known values are: "Disabled", "Enabled", and "Unknown". + :paramtype azure_arc_state: str or ~azure.mgmt.migrationassessment.models.AzureArcState + :keyword labor_cost_percentage: Gets Azure arc labour cost percentage. + :paramtype labor_cost_percentage: float + :keyword management_settings: Management settings. + :paramtype management_settings: + ~azure.mgmt.migrationassessment.models.AzureArcManagementSettings + """ + super().__init__(**kwargs) + self.azure_arc_state = azure_arc_state + self.labor_cost_percentage = labor_cost_percentage + self.management_settings = management_settings + + +class AzureAvsSummary(_serialization.Model): + """The Azure AVS summary. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar year_on_year_estimates: Shows the year-on-year cost overall. + :vartype year_on_year_estimates: ~azure.mgmt.migrationassessment.models.YearOnYearEstimates + :ivar avs_node_summary: Avs virtual machine summary. + :vartype avs_node_summary: ~azure.mgmt.migrationassessment.models.AvsNodeSummary + :ivar avs_cost_details: The on premises PaaS cost. + :vartype avs_cost_details: ~azure.mgmt.migrationassessment.models.CostDetails + """ + + _validation = { + "year_on_year_estimates": {"readonly": True}, + "avs_node_summary": {"readonly": True}, + "avs_cost_details": {"readonly": True}, + } + + _attribute_map = { + "year_on_year_estimates": {"key": "yearOnYearEstimates", "type": "YearOnYearEstimates"}, + "avs_node_summary": {"key": "avsNodeSummary", "type": "AvsNodeSummary"}, + "avs_cost_details": {"key": "avsCostDetails", "type": "CostDetails"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.year_on_year_estimates = None + self.avs_node_summary = None + self.avs_cost_details = None + + +class AzureIaasSqlSummary(_serialization.Model): + """Azure Iaas sql server summary. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar total_sql_entities: Total SQL entities. + :vartype total_sql_entities: int + :ivar suitable_sql_entities: Suitable SQL entities. + :vartype suitable_sql_entities: int + :ivar azure_sql_cost_details: The on premises PaaS cost. + :vartype azure_sql_cost_details: ~azure.mgmt.migrationassessment.models.CostDetails + :ivar estimated_cost: Estimated cost. + :vartype estimated_cost: float + :ivar os_licensing_cost: OS licensing cost. + :vartype os_licensing_cost: float + :ivar estimated_cost_by_recommended_offer: Estimated cost by offer. + :vartype estimated_cost_by_recommended_offer: + list[~azure.mgmt.migrationassessment.models.EstimatedCostByOffer] + :ivar recommended_vm_family_summary: The recommended VM family summary. + :vartype recommended_vm_family_summary: + list[~azure.mgmt.migrationassessment.models.RecommendedVmFamilySummary] + :ivar cost_by_storage_type: The cost by storage type. + :vartype cost_by_storage_type: list[~azure.mgmt.migrationassessment.models.CostByStorageType] + """ + + _validation = { + "total_sql_entities": {"readonly": True}, + "suitable_sql_entities": {"readonly": True}, + "azure_sql_cost_details": {"readonly": True}, + "estimated_cost": {"readonly": True}, + "os_licensing_cost": {"readonly": True}, + "estimated_cost_by_recommended_offer": {"readonly": True}, + "recommended_vm_family_summary": {"readonly": True}, + "cost_by_storage_type": {"readonly": True}, + } + + _attribute_map = { + "total_sql_entities": {"key": "totalSqlEntities", "type": "int"}, + "suitable_sql_entities": {"key": "suitableSqlEntities", "type": "int"}, + "azure_sql_cost_details": {"key": "azureSqlCostDetails", "type": "CostDetails"}, + "estimated_cost": {"key": "estimatedCost", "type": "float"}, + "os_licensing_cost": {"key": "osLicensingCost", "type": "float"}, + "estimated_cost_by_recommended_offer": { + "key": "estimatedCostByRecommendedOffer", + "type": "[EstimatedCostByOffer]", + }, + "recommended_vm_family_summary": {"key": "recommendedVmFamilySummary", "type": "[RecommendedVmFamilySummary]"}, + "cost_by_storage_type": {"key": "costByStorageType", "type": "[CostByStorageType]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.total_sql_entities = None + self.suitable_sql_entities = None + self.azure_sql_cost_details = None + self.estimated_cost = None + self.os_licensing_cost = None + self.estimated_cost_by_recommended_offer = None + self.recommended_vm_family_summary = None + self.cost_by_storage_type = None + + +class AzureIaasSummary(_serialization.Model): + """The Azure IaaS summary. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar year_on_year_estimates: Shows the year-on-year cost overall. + :vartype year_on_year_estimates: ~azure.mgmt.migrationassessment.models.YearOnYearEstimates + :ivar azure_iaas_vm_summary: Azure Iaas virtual machine summary. + :vartype azure_iaas_vm_summary: ~azure.mgmt.migrationassessment.models.AzureIaasVmSummary + :ivar azure_iaas_sql_summary: Azure Iaas sql server summary. + :vartype azure_iaas_sql_summary: ~azure.mgmt.migrationassessment.models.AzureIaasSqlSummary + :ivar azure_iaas_cost_details: The on premises PaaS cost. + :vartype azure_iaas_cost_details: ~azure.mgmt.migrationassessment.models.CostDetails + """ + + _validation = { + "year_on_year_estimates": {"readonly": True}, + "azure_iaas_vm_summary": {"readonly": True}, + "azure_iaas_sql_summary": {"readonly": True}, + "azure_iaas_cost_details": {"readonly": True}, + } + + _attribute_map = { + "year_on_year_estimates": {"key": "yearOnYearEstimates", "type": "YearOnYearEstimates"}, + "azure_iaas_vm_summary": {"key": "azureIaasVmSummary", "type": "AzureIaasVmSummary"}, + "azure_iaas_sql_summary": {"key": "azureIaasSqlSummary", "type": "AzureIaasSqlSummary"}, + "azure_iaas_cost_details": {"key": "azureIaasCostDetails", "type": "CostDetails"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.year_on_year_estimates = None + self.azure_iaas_vm_summary = None + self.azure_iaas_sql_summary = None + self.azure_iaas_cost_details = None + + +class AzureIaasVmSummary(_serialization.Model): + """Azure Iaas virtual machine summary. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar servers_suitable_for_migration: Servers suitable for migration. + :vartype servers_suitable_for_migration: int + :ivar total_number_of_servers: The total number of servers. + :vartype total_number_of_servers: int + :ivar cores: The total number of IaaS VM cores. + :vartype cores: int + :ivar memory_gb: The total memory in GB. + :vartype memory_gb: float + :ivar azure_vm_cost_details: The on premises PaaS cost. + :vartype azure_vm_cost_details: ~azure.mgmt.migrationassessment.models.CostDetails + :ivar estimated_cost: Estimated cost. + :vartype estimated_cost: float + :ivar os_licensing_cost: OS licensing cost. + :vartype os_licensing_cost: float + :ivar estimated_cost_by_recommended_offer: Estimated cost by offer. + :vartype estimated_cost_by_recommended_offer: + list[~azure.mgmt.migrationassessment.models.EstimatedCostByOffer] + :ivar recommended_vm_family_summary: The recommended VM family summary. + :vartype recommended_vm_family_summary: + list[~azure.mgmt.migrationassessment.models.RecommendedVmFamilySummary] + :ivar cost_by_storage_type: The cost by storage type. + :vartype cost_by_storage_type: list[~azure.mgmt.migrationassessment.models.CostByStorageType] + """ + + _validation = { + "servers_suitable_for_migration": {"readonly": True}, + "total_number_of_servers": {"readonly": True}, + "cores": {"readonly": True}, + "memory_gb": {"readonly": True}, + "azure_vm_cost_details": {"readonly": True}, + "estimated_cost": {"readonly": True}, + "os_licensing_cost": {"readonly": True}, + "estimated_cost_by_recommended_offer": {"readonly": True}, + "recommended_vm_family_summary": {"readonly": True}, + "cost_by_storage_type": {"readonly": True}, + } + + _attribute_map = { + "servers_suitable_for_migration": {"key": "serversSuitableForMigration", "type": "int"}, + "total_number_of_servers": {"key": "totalNumberOfServers", "type": "int"}, + "cores": {"key": "cores", "type": "int"}, + "memory_gb": {"key": "memoryGb", "type": "float"}, + "azure_vm_cost_details": {"key": "azureVmCostDetails", "type": "CostDetails"}, + "estimated_cost": {"key": "estimatedCost", "type": "float"}, + "os_licensing_cost": {"key": "osLicensingCost", "type": "float"}, + "estimated_cost_by_recommended_offer": { + "key": "estimatedCostByRecommendedOffer", + "type": "[EstimatedCostByOffer]", + }, + "recommended_vm_family_summary": {"key": "recommendedVmFamilySummary", "type": "[RecommendedVmFamilySummary]"}, + "cost_by_storage_type": {"key": "costByStorageType", "type": "[CostByStorageType]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.servers_suitable_for_migration = None + self.total_number_of_servers = None + self.cores = None + self.memory_gb = None + self.azure_vm_cost_details = None + self.estimated_cost = None + self.os_licensing_cost = None + self.estimated_cost_by_recommended_offer = None + self.recommended_vm_family_summary = None + self.cost_by_storage_type = None + + +class AzureKubernetesServiceSummary(_serialization.Model): + """Shows Azure Kubernetes Service summary. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar estimated_cost_by_offer: Estimated cost by recommendation offer. + :vartype estimated_cost_by_offer: + list[~azure.mgmt.migrationassessment.models.EstimatedCostByOffer] + :ivar distribution_by_sku: Distribution by SKU. + :vartype distribution_by_sku: list[~azure.mgmt.migrationassessment.models.WebAppTargetSku] + :ivar distribution_by_app: Distribution by application type. + :vartype distribution_by_app: list[~azure.mgmt.migrationassessment.models.WebAppDistribution] + """ + + _validation = { + "estimated_cost_by_offer": {"readonly": True}, + "distribution_by_sku": {"readonly": True}, + "distribution_by_app": {"readonly": True}, + } + + _attribute_map = { + "estimated_cost_by_offer": {"key": "estimatedCostByOffer", "type": "[EstimatedCostByOffer]"}, + "distribution_by_sku": {"key": "distributionBySku", "type": "[WebAppTargetSku]"}, + "distribution_by_app": {"key": "distributionByApp", "type": "[WebAppDistribution]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.estimated_cost_by_offer = None + self.distribution_by_sku = None + self.distribution_by_app = None + + +class AzureManagedDiskSkuDTO(_serialization.Model): + """Class representing an Azure Managed Disk SKU. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar disk_type: Gets the Type ("tier") of disk - e.g. standard, premium, ultra. Known values + are: "Unknown", "Standard", "StandardSSD", "Premium", "StandardOrPremium", "Ultra", and + "PremiumV2". + :vartype disk_type: str or + ~azure.mgmt.migrationassessment.models.AzureManagedDiskSkuDTODiskType + :ivar disk_size: Gets the Size of the managed disk - e.g. P30, P40. Known values are: + "Unknown", "Standard_S4", "Standard_S6", "Standard_S10", "Standard_S15", "Standard_S20", + "Standard_S30", "Standard_S40", "Standard_S50", "Standard_S60", "Standard_S70", "Standard_S80", + "Premium_P4", "Premium_P6", "Premium_P10", "Premium_P15", "Premium_P20", "Premium_P30", + "Premium_P40", "Premium_P50", "Premium_P60", "Premium_P70", "Premium_P80", "StandardSSD_E10", + "StandardSSD_E15", "StandardSSD_E20", "StandardSSD_E30", "StandardSSD_E40", "StandardSSD_E50", + "StandardSSD_E60", "StandardSSD_E70", "StandardSSD_E80", "StandardSSD_E4", "StandardSSD_E6", + "StandardSSD_E1", "StandardSSD_E2", "StandardSSD_E3", "Premium_P1", "Premium_P2", "Premium_P3", + "Ultra", and "PremiumV2". + :vartype disk_size: str or ~azure.mgmt.migrationassessment.models.AzureDiskSize + :ivar disk_redundancy: Gets disk redundancy - e.g. LRS, ZRS. Known values are: "Unknown", + "LRS", and "ZRS". + :vartype disk_redundancy: str or + ~azure.mgmt.migrationassessment.models.AzureManagedDiskSkuDTODiskRedundancy + :ivar storage_cost: Gets the managed disk storage cost. + :vartype storage_cost: float + :ivar recommended_size_in_gib: Gets the recommended in GB of the managed disk. + :vartype recommended_size_in_gib: float + :ivar recommended_throughput_in_mbps: Gets the recommended throughput in MBPS of the managed + disk. + :vartype recommended_throughput_in_mbps: float + :ivar recommended_iops: Gets the recommended IOPS of the managed disk. + :vartype recommended_iops: float + """ + + _validation = { + "disk_type": {"readonly": True}, + "disk_size": {"readonly": True}, + "disk_redundancy": {"readonly": True}, + "storage_cost": {"readonly": True}, + "recommended_size_in_gib": {"readonly": True}, + "recommended_throughput_in_mbps": {"readonly": True}, + "recommended_iops": {"readonly": True}, + } + + _attribute_map = { + "disk_type": {"key": "diskType", "type": "str"}, + "disk_size": {"key": "diskSize", "type": "str"}, + "disk_redundancy": {"key": "diskRedundancy", "type": "str"}, + "storage_cost": {"key": "storageCost", "type": "float"}, + "recommended_size_in_gib": {"key": "recommendedSizeInGib", "type": "float"}, + "recommended_throughput_in_mbps": {"key": "recommendedThroughputInMbps", "type": "float"}, + "recommended_iops": {"key": "recommendedIops", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.disk_type = None + self.disk_size = None + self.disk_redundancy = None + self.storage_cost = None + self.recommended_size_in_gib = None + self.recommended_throughput_in_mbps = None + self.recommended_iops = None + + +class AzurePaasSummary(_serialization.Model): + """Shows the PaaS Azure summary. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar total_sql_entities: Number of Sql instances. + :vartype total_sql_entities: int + :ivar suitable_sql_entities: Suitable Sql instances. + :vartype suitable_sql_entities: int + :ivar total_web_apps: Number of web applications. + :vartype total_web_apps: int + :ivar suitable_web_apps: Suitable web applications. + :vartype suitable_web_apps: int + :ivar cores: Number of cores. + :vartype cores: int + :ivar memory: Memory Utilization. + :vartype memory: float + :ivar storage: Storage Utilization. + :vartype storage: float + :ivar estimated_cost_by_target: Shows the estimated cost by target. + :vartype estimated_cost_by_target: ~azure.mgmt.migrationassessment.models.EstimatedCostByTarget + :ivar estimated_sql_server_licensing_cost: estimated SQL Server licensing cost. + :vartype estimated_sql_server_licensing_cost: float + :ivar azure_sql_summary: Shows the Azure SQL details. + :vartype azure_sql_summary: ~azure.mgmt.migrationassessment.models.AzureSqlSummary + :ivar azure_app_service_summary: Shows Azure App Service summary. + :vartype azure_app_service_summary: + ~azure.mgmt.migrationassessment.models.AzureAppServiceSummary + :ivar azure_app_service_container_summary: Shows Azure App Service Container summary. + :vartype azure_app_service_container_summary: + ~azure.mgmt.migrationassessment.models.AzureAppServiceContainerSummary + :ivar azure_kubernetes_service_summary: Shows Azure Kubernetes Service summary. + :vartype azure_kubernetes_service_summary: + ~azure.mgmt.migrationassessment.models.AzureKubernetesServiceSummary + :ivar total_azure_paas_cost: The on premises PaaS cost. + :vartype total_azure_paas_cost: ~azure.mgmt.migrationassessment.models.CostDetails + """ + + _validation = { + "total_sql_entities": {"readonly": True}, + "suitable_sql_entities": {"readonly": True}, + "total_web_apps": {"readonly": True}, + "suitable_web_apps": {"readonly": True}, + "cores": {"readonly": True}, + "memory": {"readonly": True}, + "storage": {"readonly": True}, + "estimated_cost_by_target": {"readonly": True}, + "estimated_sql_server_licensing_cost": {"readonly": True}, + "azure_sql_summary": {"readonly": True}, + "azure_app_service_summary": {"readonly": True}, + "azure_app_service_container_summary": {"readonly": True}, + "azure_kubernetes_service_summary": {"readonly": True}, + "total_azure_paas_cost": {"readonly": True}, + } + + _attribute_map = { + "total_sql_entities": {"key": "totalSqlEntities", "type": "int"}, + "suitable_sql_entities": {"key": "suitableSqlEntities", "type": "int"}, + "total_web_apps": {"key": "totalWebApps", "type": "int"}, + "suitable_web_apps": {"key": "suitableWebApps", "type": "int"}, + "cores": {"key": "cores", "type": "int"}, + "memory": {"key": "memory", "type": "float"}, + "storage": {"key": "storage", "type": "float"}, + "estimated_cost_by_target": {"key": "estimatedCostByTarget", "type": "EstimatedCostByTarget"}, + "estimated_sql_server_licensing_cost": {"key": "estimatedSqlServerLicensingCost", "type": "float"}, + "azure_sql_summary": {"key": "azureSqlSummary", "type": "AzureSqlSummary"}, + "azure_app_service_summary": {"key": "azureAppServiceSummary", "type": "AzureAppServiceSummary"}, + "azure_app_service_container_summary": { + "key": "azureAppServiceContainerSummary", + "type": "AzureAppServiceContainerSummary", + }, + "azure_kubernetes_service_summary": { + "key": "azureKubernetesServiceSummary", + "type": "AzureKubernetesServiceSummary", + }, + "total_azure_paas_cost": {"key": "totalAzurePaasCost", "type": "CostDetails"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.total_sql_entities = None + self.suitable_sql_entities = None + self.total_web_apps = None + self.suitable_web_apps = None + self.cores = None + self.memory = None + self.storage = None + self.estimated_cost_by_target = None + self.estimated_sql_server_licensing_cost = None + self.azure_sql_summary = None + self.azure_app_service_summary = None + self.azure_app_service_container_summary = None + self.azure_kubernetes_service_summary = None + self.total_azure_paas_cost = None + + +class AzureQuorumWitnessDTO(_serialization.Model): + """Quorum Witness. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar quorum_witness_type: Gets quorum witness type. Known values are: "Unknown", "Cloud", and + "Disk". + :vartype quorum_witness_type: str or + ~azure.mgmt.migrationassessment.models.AzureQuorumWitnessDTOQuorumWitnessType + """ + + _validation = { + "quorum_witness_type": {"readonly": True}, + } + + _attribute_map = { + "quorum_witness_type": {"key": "quorumWitnessType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.quorum_witness_type = None + + +class AzureResourceProperties2(_serialization.Model): + """Common properties for all azure tracked and proxy resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningState2 + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provisioning_state = None + + +class AzureSettings(_serialization.Model): + """Azure settings for a business case. + + All required parameters must be populated in order to send to server. + + :ivar target_location: Gets or sets azure location. Required. + :vartype target_location: str + :ivar discount_percentage: Gets azure Discount percentage. + :vartype discount_percentage: float + :ivar currency: Business case Currency. Required. Known values are: "Unknown", "USD", "DKK", + "CAD", "IDR", "JPY", "KRW", "NZD", "NOK", "RUB", "SAR", "ZAR", "SEK", "TRY", "GBP", "MXN", + "MYR", "INR", "HKD", "BRL", "TWD", "EUR", "CHF", "ARS", "AUD", "CNY", and "TRY". + :vartype currency: str or ~azure.mgmt.migrationassessment.models.BusinessCaseCurrency + :ivar business_case_type: Migration Strategy. Known values are: "Unknown", "OptimizeForCost", + "IaaSOnly", "OptimizeForPaas", and "AVSOnly". + :vartype business_case_type: str or ~azure.mgmt.migrationassessment.models.MigrationStrategy + :ivar workload_discovery_source: Workload discovery source. Known values are: "Unknown", + "Appliance", "Import", and "Import". + :vartype workload_discovery_source: str or + ~azure.mgmt.migrationassessment.models.DiscoverySource + :ivar performance_data_start_time: Gets start time to use for performance. + :vartype performance_data_start_time: ~datetime.datetime + :ivar performance_data_end_time: Gets end time to use for performance. + :vartype performance_data_end_time: ~datetime.datetime + :ivar comfort_factor: Gets comfort factor. + :vartype comfort_factor: float + :ivar performance_utilization_percentile: Gets utilization percentile for performance. + :vartype performance_utilization_percentile: float + :ivar per_year_migration_completion_percentage: Gets migration completion percentage per year. + :vartype per_year_migration_completion_percentage: dict[str, float] + :ivar infrastructure_growth_rate: Gets infrastructure growth rate. + :vartype infrastructure_growth_rate: float + :ivar wacc: Gets wACC percentage. + :vartype wacc: float + :ivar network_cost_percentage: Gets network cost percentage. + :vartype network_cost_percentage: float + :ivar iaas_labor_cost_percentage: Gets IaaS labour cost percentage. + :vartype iaas_labor_cost_percentage: float + :ivar paas_labor_cost_percentage: Gets PaaS labour cost percentage. + :vartype paas_labor_cost_percentage: float + :ivar avs_labor_cost_percentage: Gets Avs labour cost percentage. + :vartype avs_labor_cost_percentage: float + :ivar savings_option: Gets the business case savings option type. Known values are: "Unknown", + "RI3Year", and "SavingsPlan3Year". + :vartype savings_option: str or ~azure.mgmt.migrationassessment.models.SavingsOption + """ + + _validation = { + "target_location": {"required": True}, + "discount_percentage": {"maximum": 100, "minimum": 0}, + "currency": {"required": True}, + "performance_utilization_percentile": {"maximum": 100, "minimum": 0}, + "infrastructure_growth_rate": {"maximum": 100, "minimum": 0}, + "wacc": {"maximum": 100, "minimum": 0}, + "network_cost_percentage": {"maximum": 100, "minimum": 0}, + "iaas_labor_cost_percentage": {"maximum": 100, "minimum": 0}, + "paas_labor_cost_percentage": {"maximum": 100, "minimum": 0}, + "avs_labor_cost_percentage": {"maximum": 100, "minimum": 0}, + } + + _attribute_map = { + "target_location": {"key": "targetLocation", "type": "str"}, + "discount_percentage": {"key": "discountPercentage", "type": "float"}, + "currency": {"key": "currency", "type": "str"}, + "business_case_type": {"key": "businessCaseType", "type": "str"}, + "workload_discovery_source": {"key": "workloadDiscoverySource", "type": "str"}, + "performance_data_start_time": {"key": "performanceDataStartTime", "type": "iso-8601"}, + "performance_data_end_time": {"key": "performanceDataEndTime", "type": "iso-8601"}, + "comfort_factor": {"key": "comfortFactor", "type": "float"}, + "performance_utilization_percentile": {"key": "performanceUtilizationPercentile", "type": "float"}, + "per_year_migration_completion_percentage": {"key": "perYearMigrationCompletionPercentage", "type": "{float}"}, + "infrastructure_growth_rate": {"key": "infrastructureGrowthRate", "type": "float"}, + "wacc": {"key": "wacc", "type": "float"}, + "network_cost_percentage": {"key": "networkCostPercentage", "type": "float"}, + "iaas_labor_cost_percentage": {"key": "iaasLaborCostPercentage", "type": "float"}, + "paas_labor_cost_percentage": {"key": "paasLaborCostPercentage", "type": "float"}, + "avs_labor_cost_percentage": {"key": "avsLaborCostPercentage", "type": "float"}, + "savings_option": {"key": "savingsOption", "type": "str"}, + } + + def __init__( + self, + *, + target_location: str, + currency: Union[str, "_models.BusinessCaseCurrency"], + discount_percentage: Optional[float] = None, + business_case_type: Optional[Union[str, "_models.MigrationStrategy"]] = None, + workload_discovery_source: Optional[Union[str, "_models.DiscoverySource"]] = None, + performance_data_start_time: Optional[datetime.datetime] = None, + performance_data_end_time: Optional[datetime.datetime] = None, + comfort_factor: float = 1, + performance_utilization_percentile: float = 95, + per_year_migration_completion_percentage: Optional[Dict[str, float]] = None, + infrastructure_growth_rate: float = 5, + wacc: Optional[float] = None, + network_cost_percentage: float = 5, + iaas_labor_cost_percentage: float = 75, + paas_labor_cost_percentage: float = 60, + avs_labor_cost_percentage: float = 75, + savings_option: Optional[Union[str, "_models.SavingsOption"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword target_location: Gets or sets azure location. Required. + :paramtype target_location: str + :keyword discount_percentage: Gets azure Discount percentage. + :paramtype discount_percentage: float + :keyword currency: Business case Currency. Required. Known values are: "Unknown", "USD", "DKK", + "CAD", "IDR", "JPY", "KRW", "NZD", "NOK", "RUB", "SAR", "ZAR", "SEK", "TRY", "GBP", "MXN", + "MYR", "INR", "HKD", "BRL", "TWD", "EUR", "CHF", "ARS", "AUD", "CNY", and "TRY". + :paramtype currency: str or ~azure.mgmt.migrationassessment.models.BusinessCaseCurrency + :keyword business_case_type: Migration Strategy. Known values are: "Unknown", + "OptimizeForCost", "IaaSOnly", "OptimizeForPaas", and "AVSOnly". + :paramtype business_case_type: str or ~azure.mgmt.migrationassessment.models.MigrationStrategy + :keyword workload_discovery_source: Workload discovery source. Known values are: "Unknown", + "Appliance", "Import", and "Import". + :paramtype workload_discovery_source: str or + ~azure.mgmt.migrationassessment.models.DiscoverySource + :keyword performance_data_start_time: Gets start time to use for performance. + :paramtype performance_data_start_time: ~datetime.datetime + :keyword performance_data_end_time: Gets end time to use for performance. + :paramtype performance_data_end_time: ~datetime.datetime + :keyword comfort_factor: Gets comfort factor. + :paramtype comfort_factor: float + :keyword performance_utilization_percentile: Gets utilization percentile for performance. + :paramtype performance_utilization_percentile: float + :keyword per_year_migration_completion_percentage: Gets migration completion percentage per + year. + :paramtype per_year_migration_completion_percentage: dict[str, float] + :keyword infrastructure_growth_rate: Gets infrastructure growth rate. + :paramtype infrastructure_growth_rate: float + :keyword wacc: Gets wACC percentage. + :paramtype wacc: float + :keyword network_cost_percentage: Gets network cost percentage. + :paramtype network_cost_percentage: float + :keyword iaas_labor_cost_percentage: Gets IaaS labour cost percentage. + :paramtype iaas_labor_cost_percentage: float + :keyword paas_labor_cost_percentage: Gets PaaS labour cost percentage. + :paramtype paas_labor_cost_percentage: float + :keyword avs_labor_cost_percentage: Gets Avs labour cost percentage. + :paramtype avs_labor_cost_percentage: float + :keyword savings_option: Gets the business case savings option type. Known values are: + "Unknown", "RI3Year", and "SavingsPlan3Year". + :paramtype savings_option: str or ~azure.mgmt.migrationassessment.models.SavingsOption + """ + super().__init__(**kwargs) + self.target_location = target_location + self.discount_percentage = discount_percentage + self.currency = currency + self.business_case_type = business_case_type + self.workload_discovery_source = workload_discovery_source + self.performance_data_start_time = performance_data_start_time + self.performance_data_end_time = performance_data_end_time + self.comfort_factor = comfort_factor + self.performance_utilization_percentile = performance_utilization_percentile + self.per_year_migration_completion_percentage = per_year_migration_completion_percentage + self.infrastructure_growth_rate = infrastructure_growth_rate + self.wacc = wacc + self.network_cost_percentage = network_cost_percentage + self.iaas_labor_cost_percentage = iaas_labor_cost_percentage + self.paas_labor_cost_percentage = paas_labor_cost_percentage + self.avs_labor_cost_percentage = avs_labor_cost_percentage + self.savings_option = savings_option + + +class AzureSqlIaasSkuDTO(_serialization.Model): + """Class representing Azure SQL IAAS SKU. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar virtual_machine_size: Gets the The Azure Compute Virtual Machine. + :vartype virtual_machine_size: ~azure.mgmt.migrationassessment.models.AzureVirtualMachineSkuDTO + :ivar data_disk_sizes: Gets the The list of data disk sizes. + :vartype data_disk_sizes: list[~azure.mgmt.migrationassessment.models.AzureManagedDiskSkuDTO] + :ivar log_disk_sizes: Gets the The list of log disk sizes. + :vartype log_disk_sizes: list[~azure.mgmt.migrationassessment.models.AzureManagedDiskSkuDTO] + :ivar azure_sql_target_type: Gets the target type. Known values are: "Unknown", "Recommended", + "AzureSqlDatabase", "AzureSqlManagedInstance", "AzureSqlVirtualMachine", and + "AzureVirtualMachine". + :vartype azure_sql_target_type: str or ~azure.mgmt.migrationassessment.models.TargetType + """ + + _validation = { + "virtual_machine_size": {"readonly": True}, + "data_disk_sizes": {"readonly": True}, + "log_disk_sizes": {"readonly": True}, + "azure_sql_target_type": {"readonly": True}, + } + + _attribute_map = { + "virtual_machine_size": {"key": "virtualMachineSize", "type": "AzureVirtualMachineSkuDTO"}, + "data_disk_sizes": {"key": "dataDiskSizes", "type": "[AzureManagedDiskSkuDTO]"}, + "log_disk_sizes": {"key": "logDiskSizes", "type": "[AzureManagedDiskSkuDTO]"}, + "azure_sql_target_type": {"key": "azureSqlTargetType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.virtual_machine_size = None + self.data_disk_sizes = None + self.log_disk_sizes = None + self.azure_sql_target_type = None + + +class AzureSqlPaasSkuDTO(_serialization.Model): + """Class representing Azure SQL PAAS SKU. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar azure_sql_service_tier: Gets the service tier. Known values are: "Unknown", "Automatic", + "GeneralPurpose", "BusinessCritical", and "HyperScale". + :vartype azure_sql_service_tier: str or + ~azure.mgmt.migrationassessment.models.AzureSqlServiceTier + :ivar azure_sql_compute_tier: Gets the compute tier. Known values are: "Unknown", "Automatic", + "Provisioned", and "Serverless". + :vartype azure_sql_compute_tier: str or ~azure.mgmt.migrationassessment.models.ComputeTier + :ivar azure_sql_hardware_generation: Gets the hardware generation. Known values are: "Unknown", + "Automatic", "Gen5", "Fsv2_series", "M_series", and "DC_series". + :vartype azure_sql_hardware_generation: str or + ~azure.mgmt.migrationassessment.models.HardwareGeneration + :ivar storage_max_size_in_mb: Gets the storage maximum size in megabytes. + :vartype storage_max_size_in_mb: float + :ivar predicted_data_size_in_mb: Gets the predicted data size in megabytes in the Azure SQL, + will impact the + billing cost. + :vartype predicted_data_size_in_mb: float + :ivar predicted_log_size_in_mb: Gets the predicted log size in megabytes in the Azure SQL, will + impact the + billing cost. + :vartype predicted_log_size_in_mb: float + :ivar cores: Gets the number of cores. + :vartype cores: int + :ivar azure_sql_target_type: Gets the target type. Known values are: "Unknown", "Recommended", + "AzureSqlDatabase", "AzureSqlManagedInstance", "AzureSqlVirtualMachine", and + "AzureVirtualMachine". + :vartype azure_sql_target_type: str or ~azure.mgmt.migrationassessment.models.TargetType + """ + + _validation = { + "azure_sql_service_tier": {"readonly": True}, + "azure_sql_compute_tier": {"readonly": True}, + "azure_sql_hardware_generation": {"readonly": True}, + "storage_max_size_in_mb": {"readonly": True}, + "predicted_data_size_in_mb": {"readonly": True}, + "predicted_log_size_in_mb": {"readonly": True}, + "cores": {"readonly": True}, + "azure_sql_target_type": {"readonly": True}, + } + + _attribute_map = { + "azure_sql_service_tier": {"key": "azureSqlServiceTier", "type": "str"}, + "azure_sql_compute_tier": {"key": "azureSqlComputeTier", "type": "str"}, + "azure_sql_hardware_generation": {"key": "azureSqlHardwareGeneration", "type": "str"}, + "storage_max_size_in_mb": {"key": "storageMaxSizeInMB", "type": "float"}, + "predicted_data_size_in_mb": {"key": "predictedDataSizeInMB", "type": "float"}, + "predicted_log_size_in_mb": {"key": "predictedLogSizeInMB", "type": "float"}, + "cores": {"key": "cores", "type": "int"}, + "azure_sql_target_type": {"key": "azureSqlTargetType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.azure_sql_service_tier = None + self.azure_sql_compute_tier = None + self.azure_sql_hardware_generation = None + self.storage_max_size_in_mb = None + self.predicted_data_size_in_mb = None + self.predicted_log_size_in_mb = None + self.cores = None + self.azure_sql_target_type = None + + +class AzureSqlSummary(_serialization.Model): + """Shows the Azure SQL details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar estimated_cost_by_offer: Estimated cost by recommended offer. + :vartype estimated_cost_by_offer: + list[~azure.mgmt.migrationassessment.models.EstimatedCostByOffer] + :ivar distribution_by_service_tier: Distribution by service tiers, retaining just to support + older Business cases. + :vartype distribution_by_service_tier: + list[~azure.mgmt.migrationassessment.models.SqlServiceTier] + :ivar distribution_by_service_tier_for_sql_mi: Distribution by service tiers for SQL MI. + :vartype distribution_by_service_tier_for_sql_mi: + list[~azure.mgmt.migrationassessment.models.SqlServiceTier] + :ivar distribution_by_service_tier_for_sql_db: Distribution by service tiers for SQL DB. + :vartype distribution_by_service_tier_for_sql_db: + list[~azure.mgmt.migrationassessment.models.SqlServiceTier] + """ + + _validation = { + "estimated_cost_by_offer": {"readonly": True}, + "distribution_by_service_tier": {"readonly": True}, + "distribution_by_service_tier_for_sql_mi": {"readonly": True}, + "distribution_by_service_tier_for_sql_db": {"readonly": True}, + } + + _attribute_map = { + "estimated_cost_by_offer": {"key": "estimatedCostByOffer", "type": "[EstimatedCostByOffer]"}, + "distribution_by_service_tier": {"key": "distributionByServiceTier", "type": "[SqlServiceTier]"}, + "distribution_by_service_tier_for_sql_mi": { + "key": "distributionByServiceTierForSqlMi", + "type": "[SqlServiceTier]", + }, + "distribution_by_service_tier_for_sql_db": { + "key": "distributionByServiceTierForSqlDb", + "type": "[SqlServiceTier]", + }, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.estimated_cost_by_offer = None + self.distribution_by_service_tier = None + self.distribution_by_service_tier_for_sql_mi = None + self.distribution_by_service_tier_for_sql_db = None + + +class AzureVirtualMachineSkuDTO(_serialization.Model): + """Azure Virtual Machine SKU. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar azure_vm_family: Gets the Virtual Machine Family, for example : standardMSFamily. Known + values are: "Unknown", "Basic_A0_A4", "Standard_A0_A7", "Standard_A8_A11", "Av2_series", + "D_series", "Dv2_series", "DS_series", "DSv2_series", "F_series", "Fs_series", "G_series", + "GS_series", "H_series", "Ls_series", "Dsv3_series", "Dv3_series", "Fsv2_series", "Ev3_series", + "Esv3_series", "M_series", "DC_Series", "Lsv2_series", "Ev4_series", "Esv4_series", + "Edv4_series", "Edsv4_series", "Dv4_series", "Dsv4_series", "Ddv4_series", "Ddsv4_series", + "Easv4_series", "Dasv4_series", "Mv2_series", "Eav4_series", "Dav4_series", "Msv2_series", + "Mdsv2_series", "Dv5_series", "Dsv5_series", "Ddv5_series", "Ddsv5_series", "Dasv5_series", + "Dadsv5_series", "Ev5_series", "Esv5_series", "Edv5_series", "Edsv5_series", "Easv5_series", + "Eadsv5_series", "Ebsv5_series", and "Ebdsv5_series". + :vartype azure_vm_family: str or ~azure.mgmt.migrationassessment.models.AzureVmFamily + :ivar cores: Gets the Compute Size in vCores. + :vartype cores: int + :ivar azure_sku_name: Gets the Virtual Machine SKU name,: E.g. : Standard_F16s. Known values + are: "Unknown", "Basic_A0", "Basic_A1", "Basic_A2", "Basic_A3", "Basic_A4", "Standard_A0", + "Standard_A1", "Standard_A2", "Standard_A3", "Standard_A4", "Standard_A5", "Standard_A6", + "Standard_A7", "Standard_A8", "Standard_A9", "Standard_A10", "Standard_A11", "Standard_A1_v2", + "Standard_A2_v2", "Standard_A4_v2", "Standard_A8_v2", "Standard_A2m_v2", "Standard_A4m_v2", + "Standard_A8m_v2", "Standard_D1", "Standard_D2", "Standard_D3", "Standard_D4", "Standard_D11", + "Standard_D12", "Standard_D13", "Standard_D14", "Standard_D1_v2", "Standard_D2_v2", + "Standard_D3_v2", "Standard_D4_v2", "Standard_D5_v2", "Standard_D11_v2", "Standard_D12_v2", + "Standard_D13_v2", "Standard_D14_v2", "Standard_D15_v2", "Standard_DS1", "Standard_DS2", + "Standard_DS3", "Standard_DS4", "Standard_DS11", "Standard_DS12", "Standard_DS13", + "Standard_DS14", "Standard_DS1_v2", "Standard_DS2_v2", "Standard_DS3_v2", "Standard_DS4_v2", + "Standard_DS5_v2", "Standard_DS11_v2", "Standard_DS12_v2", "Standard_DS13_v2", + "Standard_DS14_v2", "Standard_DS15_v2", "Standard_F1", "Standard_F2", "Standard_F4", + "Standard_F8", "Standard_F16", "Standard_F1s", "Standard_F2s", "Standard_F4s", "Standard_F8s", + "Standard_F16s", "Standard_G1", "Standard_G2", "Standard_G3", "Standard_G4", "Standard_G5", + "Standard_GS1", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5", "Standard_H8", + "Standard_H16", "Standard_H8m", "Standard_H16m", "Standard_H16r", "Standard_H16mr", + "Standard_L4s", "Standard_L8s", "Standard_L16s", "Standard_L32s", "Standard_D2s_v3", + "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", + "Standard_D64s_v3", "Standard_D2_v3", "Standard_D4_v3", "Standard_D8_v3", "Standard_D16_v3", + "Standard_D32_v3", "Standard_D64_v3", "Standard_F2s_v2", "Standard_F4s_v2", "Standard_F8s_v2", + "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", + "Standard_E2_v3", "Standard_E4_v3", "Standard_E8_v3", "Standard_E16_v3", "Standard_E32_v3", + "Standard_E64_v3", "Standard_E2s_v3", "Standard_E4s_v3", "Standard_E8s_v3", "Standard_E16s_v3", + "Standard_E32s_v3", "Standard_E64s_v3", "Standard_M64s", "Standard_M64ms", "Standard_M128s", + "Standard_M128ms", "Standard_DC2s", "Standard_DC4s", "Standard_E20_v3", "Standard_E20s_v3", + "Standard_E64i_v3", "Standard_E64is_v3", "Standard_M8ms", "Standard_M16ms", "Standard_M32ls", + "Standard_M32ms", "Standard_M32ts", "Standard_M64", "Standard_M64ls", "Standard_M64m", + "Standard_M128", "Standard_M128m", "Standard_L8s_v2", "Standard_L16s_v2", "Standard_L32s_v2", + "Standard_L48s_v2", "Standard_L64s_v2", "Standard_L80s_v2", "Standard_D2_v4", "Standard_D4_v4", + "Standard_D8_v4", "Standard_D16_v4", "Standard_D32_v4", "Standard_D48_v4", "Standard_D64_v4", + "Standard_D2s_v4", "Standard_D4s_v4", "Standard_D8s_v4", "Standard_D16s_v4", + "Standard_D32s_v4", "Standard_D48s_v4", "Standard_D64s_v4", "Standard_D2d_v4", + "Standard_D4d_v4", "Standard_D8d_v4", "Standard_D16d_v4", "Standard_D32d_v4", + "Standard_D48d_v4", "Standard_D64d_v4", "Standard_D2ds_v4", "Standard_D4ds_v4", + "Standard_D8ds_v4", "Standard_D16ds_v4", "Standard_D32ds_v4", "Standard_D48ds_v4", + "Standard_D64ds_v4", "Standard_E2_v4", "Standard_E4_v4", "Standard_E8_v4", "Standard_E16_v4", + "Standard_E20_v4", "Standard_E32_v4", "Standard_E48_v4", "Standard_E64_v4", "Standard_E2s_v4", + "Standard_E4s_v4", "Standard_E8s_v4", "Standard_E16s_v4", "Standard_E20s_v4", + "Standard_E32s_v4", "Standard_E48s_v4", "Standard_E64s_v4", "Standard_E2d_v4", + "Standard_E4d_v4", "Standard_E8d_v4", "Standard_E16d_v4", "Standard_E20d_v4", + "Standard_E32d_v4", "Standard_E48d_v4", "Standard_E64d_v4", "Standard_E2ds_v4", + "Standard_E4ds_v4", "Standard_E8ds_v4", "Standard_E16ds_v4", "Standard_E20ds_v4", + "Standard_E32ds_v4", "Standard_E48ds_v4", "Standard_E64ds_v4", "Standard_E2as_v4", + "Standard_E4as_v4", "Standard_E8as_v4", "Standard_E16as_v4", "Standard_E20as_v4", + "Standard_E32as_v4", "Standard_E48as_v4", "Standard_E64as_v4", "Standard_E96as_v4", + "Standard_D2as_v4", "Standard_D4as_v4", "Standard_D8as_v4", "Standard_D16as_v4", + "Standard_D32as_v4", "Standard_D48as_v4", "Standard_D64as_v4", "Standard_D96as_v4", + "Standard_M208ms_v2", "Standard_M208s_v2", "Standard_M416ms_v2", "Standard_M416s_v2", + "Standard_F48s_v2", "Standard_E48_v3", "Standard_E48s_v3", "Standard_E80is_v4", + "Standard_E80ids_v4", "Standard_E2a_v4", "Standard_E4a_v4", "Standard_E8a_v4", + "Standard_E16a_v4", "Standard_E20a_v4", "Standard_E32a_v4", "Standard_E48a_v4", + "Standard_E64a_v4", "Standard_E96a_v4", "Standard_D2a_v4", "Standard_D4a_v4", + "Standard_D8a_v4", "Standard_D16a_v4", "Standard_D32a_v4", "Standard_D48a_v4", + "Standard_D64a_v4", "Standard_D96a_v4", "Standard_M32ms_v2", "Standard_M64s_v2", + "Standard_M64ms_v2", "Standard_M128s_v2", "Standard_M128ms_v2", "Standard_M192is_v2", + "Standard_M192ims_v2", "Standard_M32dms_v2", "Standard_M64ds_v2", "Standard_M64dms_v2", + "Standard_M128ds_v2", "Standard_M128dms_v2", "Standard_M192ids_v2", "Standard_M192idms_v2", + "Standard_D2_v5", "Standard_D4_v5", "Standard_D8_v5", "Standard_D16_v5", "Standard_D32_v5", + "Standard_D48_v5", "Standard_D64_v5", "Standard_D96_v5", "Standard_D2s_v5", "Standard_D4s_v5", + "Standard_D8s_v5", "Standard_D16s_v5", "Standard_D32s_v5", "Standard_D48s_v5", + "Standard_D64s_v5", "Standard_D96s_v5", "Standard_D2d_v5", "Standard_D4d_v5", + "Standard_D8d_v5", "Standard_D16d_v5", "Standard_D32d_v5", "Standard_D48d_v5", + "Standard_D64d_v5", "Standard_D96d_v5", "Standard_D2ds_v5", "Standard_D4ds_v5", + "Standard_D8ds_v5", "Standard_D16ds_v5", "Standard_D32ds_v5", "Standard_D48ds_v5", + "Standard_D64ds_v5", "Standard_D96ds_v5", "Standard_D2as_v5", "Standard_D4as_v5", + "Standard_D8as_v5", "Standard_D16as_v5", "Standard_D32as_v5", "Standard_D48as_v5", + "Standard_D64as_v5", "Standard_D96as_v5", "Standard_D2ads_v5", "Standard_D4ads_v5", + "Standard_D8ads_v5", "Standard_D16ads_v5", "Standard_D32ads_v5", "Standard_D48ads_v5", + "Standard_D64ads_v5", "Standard_D96ads_v5", "Standard_E2_v5", "Standard_E4_v5", + "Standard_E8_v5", "Standard_E16_v5", "Standard_E20_v5", "Standard_E32_v5", "Standard_E48_v5", + "Standard_E64_v5", "Standard_E96_v5", "Standard_E104i_v5", "Standard_E2s_v5", + "Standard_E4s_v5", "Standard_E8s_v5", "Standard_E16s_v5", "Standard_E20s_v5", + "Standard_E32s_v5", "Standard_E48s_v5", "Standard_E64s_v5", "Standard_E96s_v5", + "Standard_E104is_v5", "Standard_E2d_v5", "Standard_E4d_v5", "Standard_E8d_v5", + "Standard_E16d_v5", "Standard_E20d_v5", "Standard_E32d_v5", "Standard_E48d_v5", + "Standard_E64d_v5", "Standard_E96d_v5", "Standard_E104id_v5", "Standard_E2ds_v5", + "Standard_E4ds_v5", "Standard_E8ds_v5", "Standard_E16ds_v5", "Standard_E20ds_v5", + "Standard_E32ds_v5", "Standard_E48ds_v5", "Standard_E64ds_v5", "Standard_E96ds_v5", + "Standard_E104ids_v5", "Standard_E2as_v5", "Standard_E4as_v5", "Standard_E8as_v5", + "Standard_E16as_v5", "Standard_E20as_v5", "Standard_E32as_v5", "Standard_E48as_v5", + "Standard_E64as_v5", "Standard_E96as_v5", "Standard_E2ads_v5", "Standard_E4ads_v5", + "Standard_E8ads_v5", "Standard_E16ads_v5", "Standard_E20ads_v5", "Standard_E32ads_v5", + "Standard_E48ads_v5", "Standard_E64ads_v5", "Standard_E96ads_v5", "Standard_M8_2ms", + "Standard_M8_4ms", "Standard_M16_4ms", "Standard_M16_8ms", "Standard_M32_8ms", + "Standard_M32_16ms", "Standard_M64_32ms", "Standard_M64_16ms", "Standard_M128_64ms", + "Standard_M128_32ms", "Standard_E4_2s_v3", "Standard_E8_4s_v3", "Standard_E8_2s_v3", + "Standard_E16_8s_v3", "Standard_E16_4s_v3", "Standard_E32_16s_v3", "Standard_E32_8s_v3", + "Standard_E64_32s_v3", "Standard_E64_16s_v3", "Standard_E4_2s_v4", "Standard_E8_4s_v4", + "Standard_E8_2s_v4", "Standard_E16_8s_v4", "Standard_E16_4s_v4", "Standard_E32_16s_v4", + "Standard_E32_8s_v4", "Standard_E64_32s_v4", "Standard_E64_16s_v4", "Standard_E4_2ds_v4", + "Standard_E8_4ds_v4", "Standard_E8_2ds_v4", "Standard_E16_8ds_v4", "Standard_E16_4ds_v4", + "Standard_E32_16ds_v4", "Standard_E32_8ds_v4", "Standard_E64_32ds_v4", "Standard_E64_16ds_v4", + "Standard_E4_2as_v4", "Standard_E8_4as_v4", "Standard_E8_2as_v4", "Standard_E16_8as_v4", + "Standard_E16_4as_v4", "Standard_E32_16as_v4", "Standard_E32_8as_v4", "Standard_E64_32as_v4", + "Standard_E64_16as_v4", "Standard_E96_48as_v4", "Standard_E96_24as_v4", "Standard_E4_2ads_v5", + "Standard_E8_4ads_v5", "Standard_E8_2ads_v5", "Standard_E16_8ads_v5", "Standard_E16_4ads_v5", + "Standard_E32_16ads_v5", "Standard_E32_8ads_v5", "Standard_E64_32ads_v5", + "Standard_E64_16ads_v5", "Standard_E96_48ads_v5", "Standard_E96_24ads_v5", "Standard_E4_2s_v5", + "Standard_E8_4s_v5", "Standard_E8_2s_v5", "Standard_E16_8s_v5", "Standard_E16_4s_v5", + "Standard_E32_16s_v5", "Standard_E32_8s_v5", "Standard_E64_32s_v5", "Standard_E64_16s_v5", + "Standard_E96_48s_v5", "Standard_E96_24s_v5", "Standard_E4_2ds_v5", "Standard_E8_4ds_v5", + "Standard_E8_2ds_v5", "Standard_E16_8ds_v5", "Standard_E16_4ds_v5", "Standard_E32_16ds_v5", + "Standard_E32_8ds_v5", "Standard_E64_32ds_v5", "Standard_E64_16ds_v5", "Standard_E96_48ds_v5", + "Standard_E96_24ds_v5", "Standard_E4_2as_v5", "Standard_E8_4as_v5", "Standard_E8_2as_v5", + "Standard_E16_8as_v5", "Standard_E16_4as_v5", "Standard_E32_16as_v5", "Standard_E32_8as_v5", + "Standard_E64_32as_v5", "Standard_E64_16as_v5", "Standard_E96_48as_v5", "Standard_E96_24as_v5", + "Standard_GS4_8", "Standard_GS4_4", "Standard_GS5_16", "Standard_GS5_8", "Standard_DS11_1_v2", + "Standard_DS12_2_v2", "Standard_DS12_1_v2", "Standard_DS13_4_v2", "Standard_DS13_2_v2", + "Standard_DS14_8_v2", "Standard_DS14_4_v2", "Standard_M416_208s_v2", "Standard_M416_208ms_v2", + "Standard_E2bs_v5", "Standard_E4bs_v5", "Standard_E8bs_v5", "Standard_E16bs_v5", + "Standard_E32bs_v5", "Standard_E48bs_v5", "Standard_E64bs_v5", "Standard_E2bds_v5", + "Standard_E4bds_v5", "Standard_E8bds_v5", "Standard_E16bds_v5", "Standard_E32bds_v5", + "Standard_E48bds_v5", and "Standard_E64bds_v5". + :vartype azure_sku_name: str or ~azure.mgmt.migrationassessment.models.AzureVmSize + :ivar available_cores: Gets the Available vCores. This can be less than the vCores in the + Constrained + vCPU VM Sizes. + :vartype available_cores: int + :ivar max_network_interfaces: Gets the Max network interfaces. + :vartype max_network_interfaces: int + """ + + _validation = { + "azure_vm_family": {"readonly": True}, + "cores": {"readonly": True}, + "azure_sku_name": {"readonly": True}, + "available_cores": {"readonly": True}, + "max_network_interfaces": {"readonly": True}, + } + + _attribute_map = { + "azure_vm_family": {"key": "azureVmFamily", "type": "str"}, + "cores": {"key": "cores", "type": "int"}, + "azure_sku_name": {"key": "azureSkuName", "type": "str"}, + "available_cores": {"key": "availableCores", "type": "int"}, + "max_network_interfaces": {"key": "maxNetworkInterfaces", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.azure_vm_family = None + self.cores = None + self.azure_sku_name = None + self.available_cores = None + self.max_network_interfaces = None + + +class BusinessCase(ProxyResource): + """Business case 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.BusinessCaseProperties + """ + + _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": "BusinessCaseProperties"}, + } + + def __init__(self, *, properties: Optional["_models.BusinessCaseProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.BusinessCaseProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class BusinessCaseListResult(_serialization.Model): + """The response of a BusinessCase list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The BusinessCase items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.BusinessCase] + :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": "[BusinessCase]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.BusinessCase"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The BusinessCase items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.BusinessCase] + :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 BusinessCaseProperties(AzureResourceProperties2): + """Property bag for an + Microsoft.Azure.Migrate.BusinessCaseService.Api.V20220202_preview.Resources.BusinessCase + resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningState2 + :ivar settings: Business case settings. + :vartype settings: ~azure.mgmt.migrationassessment.models.Settings + :ivar state: Business case state. Known values are: "Unknown", "InProgress", "Completed", + "OutDated", "Invalid", "OutOfSync", and "Failed". + :vartype state: str or ~azure.mgmt.migrationassessment.models.BusinessCaseState + :ivar report_status_details: Gets the state of business case reports. + :vartype report_status_details: list[~azure.mgmt.migrationassessment.models.ReportDetails] + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "state": {"readonly": True}, + "report_status_details": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "settings": {"key": "settings", "type": "Settings"}, + "state": {"key": "state", "type": "str"}, + "report_status_details": {"key": "reportStatusDetails", "type": "[ReportDetails]"}, + } + + def __init__(self, *, settings: Optional["_models.Settings"] = None, **kwargs: Any) -> None: + """ + :keyword settings: Business case settings. + :paramtype settings: ~azure.mgmt.migrationassessment.models.Settings + """ + super().__init__(**kwargs) + self.settings = settings + self.state = None + self.report_status_details = None + + +class Check(_serialization.Model): + """Data model of Check or Rule for Suitability Analysis. + + 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 name: Gets name. Required. + :vartype name: str + :ivar behavior: Gets behavior or check result. Required. Known values are: "Unknown", "Issue", + "Warn", "Pass", and "Pass". + :vartype behavior: str or ~azure.mgmt.migrationassessment.models.CheckResult + :ivar description: Gets description. Required. + :vartype description: str + :ivar cause: Gets cause. Required. + :vartype cause: str + :ivar recommendation: Gets recommendation. Required. + :vartype recommendation: str + :ivar more_info: Gets more information about check or rule. Required. + :vartype more_info: ~azure.mgmt.migrationassessment.models.MoreInfo + """ + + _validation = { + "name": {"required": True, "readonly": True}, + "behavior": {"required": True, "readonly": True}, + "description": {"required": True, "readonly": True}, + "cause": {"required": True, "readonly": True}, + "recommendation": {"required": True, "readonly": True}, + "more_info": {"required": True, "readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "behavior": {"key": "behavior", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "cause": {"key": "cause", "type": "str"}, + "recommendation": {"key": "recommendation", "type": "str"}, + "more_info": {"key": "moreInfo", "type": "MoreInfo"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.behavior = None + self.description = None + self.cause = None + self.recommendation = None + self.more_info = None + + +class CollectorAgentPropertiesBase(_serialization.Model): + """Collector agent property class. + + :ivar id: Gets the collector agent id. + :vartype id: str + :ivar version: Gets the collector agent version. + :vartype version: str + :ivar last_heartbeat_utc: Gets the collector last heartbeat time. + :vartype last_heartbeat_utc: ~datetime.datetime + :ivar spn_details: Gets or sets the SPN details. + :vartype spn_details: ~azure.mgmt.migrationassessment.models.CollectorAgentSpnPropertiesBase + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "last_heartbeat_utc": {"key": "lastHeartbeatUtc", "type": "iso-8601"}, + "spn_details": {"key": "spnDetails", "type": "CollectorAgentSpnPropertiesBase"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + version: Optional[str] = None, + last_heartbeat_utc: Optional[datetime.datetime] = None, + spn_details: Optional["_models.CollectorAgentSpnPropertiesBase"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Gets the collector agent id. + :paramtype id: str + :keyword version: Gets the collector agent version. + :paramtype version: str + :keyword last_heartbeat_utc: Gets the collector last heartbeat time. + :paramtype last_heartbeat_utc: ~datetime.datetime + :keyword spn_details: Gets or sets the SPN details. + :paramtype spn_details: ~azure.mgmt.migrationassessment.models.CollectorAgentSpnPropertiesBase + """ + super().__init__(**kwargs) + self.id = id + self.version = version + self.last_heartbeat_utc = last_heartbeat_utc + self.spn_details = spn_details + + +class CollectorAgentSpnPropertiesBase(_serialization.Model): + """Collector agent SPN details class. + + :ivar authority: Gets the AAD authority endpoint. + :vartype authority: str + :ivar application_id: Gets the AAD application id. + :vartype application_id: str + :ivar audience: Gets the AAD audience url. + :vartype audience: str + :ivar object_id: Gets the object id of the AAD application. + :vartype object_id: str + :ivar tenant_id: Gets the tenant id of the AAD application. + :vartype tenant_id: str + """ + + _attribute_map = { + "authority": {"key": "authority", "type": "str"}, + "application_id": {"key": "applicationId", "type": "str"}, + "audience": {"key": "audience", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + } + + def __init__( + self, + *, + authority: Optional[str] = None, + application_id: Optional[str] = None, + audience: Optional[str] = None, + object_id: Optional[str] = None, + tenant_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword authority: Gets the AAD authority endpoint. + :paramtype authority: str + :keyword application_id: Gets the AAD application id. + :paramtype application_id: str + :keyword audience: Gets the AAD audience url. + :paramtype audience: str + :keyword object_id: Gets the object id of the AAD application. + :paramtype object_id: str + :keyword tenant_id: Gets the tenant id of the AAD application. + :paramtype tenant_id: str + """ + super().__init__(**kwargs) + self.authority = authority + self.application_id = application_id + self.audience = audience + self.object_id = object_id + self.tenant_id = tenant_id + + +class CollectorPropertiesBase(AzureResourceProperties): + """Collector properties class. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningState + :ivar discovery_site_id: Gets the discovery site id. + :vartype discovery_site_id: str + :ivar created_timestamp: Gets the Timestamp when collector was created. + :vartype created_timestamp: ~datetime.datetime + :ivar updated_timestamp: Timestamp when collector was last updated. + :vartype updated_timestamp: ~datetime.datetime + """ + + _validation = { + "created_timestamp": {"readonly": True}, + "updated_timestamp": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "discovery_site_id": {"key": "discoverySiteId", "type": "str"}, + "created_timestamp": {"key": "createdTimestamp", "type": "iso-8601"}, + "updated_timestamp": {"key": "updatedTimestamp", "type": "iso-8601"}, + } + + def __init__( + self, + *, + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, + discovery_site_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :paramtype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningState + :keyword discovery_site_id: Gets the discovery site id. + :paramtype discovery_site_id: str + """ + super().__init__(provisioning_state=provisioning_state, **kwargs) + self.discovery_site_id = discovery_site_id + self.created_timestamp = None + self.updated_timestamp = None + + +class CollectorPropertiesBaseWithAgent(AzureResourceProperties): + """Collector properties class. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningState + :ivar agent_properties: Gets or sets the collector agent properties. + :vartype agent_properties: ~azure.mgmt.migrationassessment.models.CollectorAgentPropertiesBase + :ivar discovery_site_id: Gets the discovery site id. + :vartype discovery_site_id: str + :ivar created_timestamp: Gets the Timestamp when collector was created. + :vartype created_timestamp: ~datetime.datetime + :ivar updated_timestamp: Timestamp when collector was last updated. + :vartype updated_timestamp: ~datetime.datetime + """ + + _validation = { + "created_timestamp": {"readonly": True}, + "updated_timestamp": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "agent_properties": {"key": "agentProperties", "type": "CollectorAgentPropertiesBase"}, + "discovery_site_id": {"key": "discoverySiteId", "type": "str"}, + "created_timestamp": {"key": "createdTimestamp", "type": "iso-8601"}, + "updated_timestamp": {"key": "updatedTimestamp", "type": "iso-8601"}, + } + + def __init__( + self, + *, + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, + agent_properties: Optional["_models.CollectorAgentPropertiesBase"] = None, + discovery_site_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :paramtype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningState + :keyword agent_properties: Gets or sets the collector agent properties. + :paramtype agent_properties: + ~azure.mgmt.migrationassessment.models.CollectorAgentPropertiesBase + :keyword discovery_site_id: Gets the discovery site id. + :paramtype discovery_site_id: str + """ + super().__init__(provisioning_state=provisioning_state, **kwargs) + self.agent_properties = agent_properties + self.discovery_site_id = discovery_site_id + self.created_timestamp = None + self.updated_timestamp = None + + +class CompareSummary(_serialization.Model): + """Compare summary class. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar azure_paas_cost_details: The azure PaaS cost. + :vartype azure_paas_cost_details: ~azure.mgmt.migrationassessment.models.CostDetails + :ivar azure_iaas_cost_details: The azure IaaS cost. + :vartype azure_iaas_cost_details: ~azure.mgmt.migrationassessment.models.CostDetails + :ivar azure_avs_cost_details: The AVS cost. + :vartype azure_avs_cost_details: ~azure.mgmt.migrationassessment.models.CostDetails + :ivar on_premises_paas_cost_details: The on premises PaaS cost. + :vartype on_premises_paas_cost_details: ~azure.mgmt.migrationassessment.models.CostDetails + :ivar on_premises_iaas_cost_details: The on premises IaaS cost. + :vartype on_premises_iaas_cost_details: ~azure.mgmt.migrationassessment.models.CostDetails + :ivar on_premises_avs_cost_details: The on premises AVS cost. + :vartype on_premises_avs_cost_details: ~azure.mgmt.migrationassessment.models.CostDetails + :ivar on_premises_paas_decommissioned_cost_details: The on premises PaaS decommissioned cost. + :vartype on_premises_paas_decommissioned_cost_details: + ~azure.mgmt.migrationassessment.models.CostDetails + :ivar on_premises_iaas_decommissioned_cost_details: The on premises IaaS decommissioned cost. + :vartype on_premises_iaas_decommissioned_cost_details: + ~azure.mgmt.migrationassessment.models.CostDetails + :ivar on_premises_avs_decommissioned_cost_details: The on premises AVS decommissioned cost. + :vartype on_premises_avs_decommissioned_cost_details: + ~azure.mgmt.migrationassessment.models.CostDetails + :ivar future_cost_details: Future state cost which includes Azure cost and Arc enabled + on-premises cost based on the final migration percentage. + :vartype future_cost_details: ~azure.mgmt.migrationassessment.models.CostDetails + :ivar azure_arc_enabled_on_premises_cost_details: The Azure arc enabled on-premises cost. + :vartype azure_arc_enabled_on_premises_cost_details: + ~azure.mgmt.migrationassessment.models.CostDetails + :ivar future_azure_arc_enabled_on_premises_cost_details: The final azure arc enabled + on-premises cost based on the final migration percentage. + :vartype future_azure_arc_enabled_on_premises_cost_details: + ~azure.mgmt.migrationassessment.models.CostDetails + """ + + _validation = { + "azure_paas_cost_details": {"readonly": True}, + "azure_iaas_cost_details": {"readonly": True}, + "azure_avs_cost_details": {"readonly": True}, + "on_premises_paas_cost_details": {"readonly": True}, + "on_premises_iaas_cost_details": {"readonly": True}, + "on_premises_avs_cost_details": {"readonly": True}, + "on_premises_paas_decommissioned_cost_details": {"readonly": True}, + "on_premises_iaas_decommissioned_cost_details": {"readonly": True}, + "on_premises_avs_decommissioned_cost_details": {"readonly": True}, + "future_cost_details": {"readonly": True}, + "azure_arc_enabled_on_premises_cost_details": {"readonly": True}, + "future_azure_arc_enabled_on_premises_cost_details": {"readonly": True}, + } + + _attribute_map = { + "azure_paas_cost_details": {"key": "azurePaasCostDetails", "type": "CostDetails"}, + "azure_iaas_cost_details": {"key": "azureIaasCostDetails", "type": "CostDetails"}, + "azure_avs_cost_details": {"key": "azureAvsCostDetails", "type": "CostDetails"}, + "on_premises_paas_cost_details": {"key": "onPremisesPaasCostDetails", "type": "CostDetails"}, + "on_premises_iaas_cost_details": {"key": "onPremisesIaasCostDetails", "type": "CostDetails"}, + "on_premises_avs_cost_details": {"key": "onPremisesAvsCostDetails", "type": "CostDetails"}, + "on_premises_paas_decommissioned_cost_details": { + "key": "onPremisesPaasDecommissionedCostDetails", + "type": "CostDetails", + }, + "on_premises_iaas_decommissioned_cost_details": { + "key": "onPremisesIaasDecommissionedCostDetails", + "type": "CostDetails", + }, + "on_premises_avs_decommissioned_cost_details": { + "key": "onPremisesAvsDecommissionedCostDetails", + "type": "CostDetails", + }, + "future_cost_details": {"key": "futureCostDetails", "type": "CostDetails"}, + "azure_arc_enabled_on_premises_cost_details": { + "key": "azureArcEnabledOnPremisesCostDetails", + "type": "CostDetails", + }, + "future_azure_arc_enabled_on_premises_cost_details": { + "key": "futureAzureArcEnabledOnPremisesCostDetails", + "type": "CostDetails", + }, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.azure_paas_cost_details = None + self.azure_iaas_cost_details = None + self.azure_avs_cost_details = None + self.on_premises_paas_cost_details = None + self.on_premises_iaas_cost_details = None + self.on_premises_avs_cost_details = None + self.on_premises_paas_decommissioned_cost_details = None + self.on_premises_iaas_decommissioned_cost_details = None + self.on_premises_avs_decommissioned_cost_details = None + self.future_cost_details = None + self.azure_arc_enabled_on_premises_cost_details = None + self.future_azure_arc_enabled_on_premises_cost_details = None + + +class ComputeResource(_serialization.Model): + """Data model of Cores and Memory Compute Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar cores: Gets cores. Required. + :vartype cores: float + :ivar memory: Gets memory. Required. + :vartype memory: float + """ + + _validation = { + "cores": {"required": True, "readonly": True}, + "memory": {"required": True, "readonly": True}, + } + + _attribute_map = { + "cores": {"key": "cores", "type": "float"}, + "memory": {"key": "memory", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.cores = None + self.memory = None + + +class ComputeSettings(_serialization.Model): + """Compute settings. + + All required parameters must be populated in order to send to server. + + :ivar hyperthread_core_to_memory_ratio: Hyperthread core to memory ratio. Required. + :vartype hyperthread_core_to_memory_ratio: float + :ivar price: Compute Price. Required. + :vartype price: float + :ivar sql_server_licensing: SQL Server licensing settings. Required. + :vartype sql_server_licensing: + list[~azure.mgmt.migrationassessment.models.SqlServerLicensingSettings] + :ivar windows_server_licensing: Windows Server licensing settings. Required. + :vartype windows_server_licensing: + ~azure.mgmt.migrationassessment.models.WindowsServerLicensingSettings + :ivar rhel_linux_server_licensing: Linux Rhel Server licensing settings. Required. + :vartype rhel_linux_server_licensing: + ~azure.mgmt.migrationassessment.models.LinuxServerLicensingSettings + :ivar suse_linux_server_licensing: Linux Suse Server licensing settings. Required. + :vartype suse_linux_server_licensing: + ~azure.mgmt.migrationassessment.models.LinuxServerLicensingSettings + :ivar virtualization_software_settings: Virtualization software settings. Required. + :vartype virtualization_software_settings: + ~azure.mgmt.migrationassessment.models.VirtualizationSoftwareSettings + """ + + _validation = { + "hyperthread_core_to_memory_ratio": {"required": True}, + "price": {"required": True}, + "sql_server_licensing": {"required": True}, + "windows_server_licensing": {"required": True}, + "rhel_linux_server_licensing": {"required": True}, + "suse_linux_server_licensing": {"required": True}, + "virtualization_software_settings": {"required": True}, + } + + _attribute_map = { + "hyperthread_core_to_memory_ratio": {"key": "hyperthreadCoreToMemoryRatio", "type": "float"}, + "price": {"key": "price", "type": "float"}, + "sql_server_licensing": {"key": "sqlServerLicensing", "type": "[SqlServerLicensingSettings]"}, + "windows_server_licensing": {"key": "windowsServerLicensing", "type": "WindowsServerLicensingSettings"}, + "rhel_linux_server_licensing": {"key": "rhelLinuxServerLicensing", "type": "LinuxServerLicensingSettings"}, + "suse_linux_server_licensing": {"key": "suseLinuxServerLicensing", "type": "LinuxServerLicensingSettings"}, + "virtualization_software_settings": { + "key": "virtualizationSoftwareSettings", + "type": "VirtualizationSoftwareSettings", + }, + } + + def __init__( + self, + *, + hyperthread_core_to_memory_ratio: float, + price: float, + sql_server_licensing: List["_models.SqlServerLicensingSettings"], + windows_server_licensing: "_models.WindowsServerLicensingSettings", + rhel_linux_server_licensing: "_models.LinuxServerLicensingSettings", + suse_linux_server_licensing: "_models.LinuxServerLicensingSettings", + virtualization_software_settings: "_models.VirtualizationSoftwareSettings", + **kwargs: Any + ) -> None: + """ + :keyword hyperthread_core_to_memory_ratio: Hyperthread core to memory ratio. Required. + :paramtype hyperthread_core_to_memory_ratio: float + :keyword price: Compute Price. Required. + :paramtype price: float + :keyword sql_server_licensing: SQL Server licensing settings. Required. + :paramtype sql_server_licensing: + list[~azure.mgmt.migrationassessment.models.SqlServerLicensingSettings] + :keyword windows_server_licensing: Windows Server licensing settings. Required. + :paramtype windows_server_licensing: + ~azure.mgmt.migrationassessment.models.WindowsServerLicensingSettings + :keyword rhel_linux_server_licensing: Linux Rhel Server licensing settings. Required. + :paramtype rhel_linux_server_licensing: + ~azure.mgmt.migrationassessment.models.LinuxServerLicensingSettings + :keyword suse_linux_server_licensing: Linux Suse Server licensing settings. Required. + :paramtype suse_linux_server_licensing: + ~azure.mgmt.migrationassessment.models.LinuxServerLicensingSettings + :keyword virtualization_software_settings: Virtualization software settings. Required. + :paramtype virtualization_software_settings: + ~azure.mgmt.migrationassessment.models.VirtualizationSoftwareSettings + """ + super().__init__(**kwargs) + self.hyperthread_core_to_memory_ratio = hyperthread_core_to_memory_ratio + self.price = price + self.sql_server_licensing = sql_server_licensing + self.windows_server_licensing = windows_server_licensing + self.rhel_linux_server_licensing = rhel_linux_server_licensing + self.suse_linux_server_licensing = suse_linux_server_licensing + self.virtualization_software_settings = virtualization_software_settings + + +class CostByStorageType(_serialization.Model): + """The cost by storage type. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar storage_type: The storage type. + :vartype storage_type: str + :ivar cost: Cost per storage type. + :vartype cost: float + """ + + _validation = { + "storage_type": {"readonly": True}, + "cost": {"readonly": True}, + } + + _attribute_map = { + "storage_type": {"key": "storageType", "type": "str"}, + "cost": {"key": "cost", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.storage_type = None + self.cost = None + + +class CostComponent(_serialization.Model): + """Class to represent the component of the cost. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Gets the name of the component. Known values are: "Unknown", + "MonthlyAzureHybridCostSavings", "MonthlySecurityCost", "MonthlyPremiumV2StorageCost", + "MonthlyLinuxAzureHybridCostSavings", "MonthlyAvsNodeCost", "MonthlyAvsExternalStorageCost", + "MonthlyAvsNetworkCost", and "MonthlyVcfByolCostDifference". + :vartype name: str or ~azure.mgmt.migrationassessment.models.CostComponentName + :ivar value: The value of the component. + :vartype value: float + :ivar description: The textual description of the component. + :vartype description: str + """ + + _validation = { + "name": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "float"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__(self, *, value: Optional[float] = None, description: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The value of the component. + :paramtype value: float + :keyword description: The textual description of the component. + :paramtype description: str + """ + super().__init__(**kwargs) + self.name = None + self.value = value + self.description = description + + +class CostDetails(_serialization.Model): + """The on premises PaaS cost. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar storage_cost: The storage cost. + :vartype storage_cost: float + :ivar compute_cost: The compute cost. + :vartype compute_cost: float + :ivar it_labor_cost: The IT labor cost. + :vartype it_labor_cost: float + :ivar network_cost: The network cost. + :vartype network_cost: float + :ivar ahub_savings: The windows AhubSavings. + :vartype ahub_savings: float + :ivar linux_ahub_savings: The linux AhubSavings. + :vartype linux_ahub_savings: float + :ivar security_cost: Security Cost. + :vartype security_cost: float + :ivar management_cost_details: Management Cost Details. + :vartype management_cost_details: ~azure.mgmt.migrationassessment.models.ManagementCostDetails + :ivar esu_savings: esu savings. + :vartype esu_savings: float + :ivar facilities_cost: The facilities cost related to hosting customer workloads in a + datacenter. + :vartype facilities_cost: float + """ + + _validation = { + "storage_cost": {"readonly": True}, + "compute_cost": {"readonly": True}, + "it_labor_cost": {"readonly": True}, + "network_cost": {"readonly": True}, + "ahub_savings": {"readonly": True}, + "linux_ahub_savings": {"readonly": True}, + "security_cost": {"readonly": True}, + "management_cost_details": {"readonly": True}, + "esu_savings": {"readonly": True}, + "facilities_cost": {"readonly": True}, + } + + _attribute_map = { + "storage_cost": {"key": "storageCost", "type": "float"}, + "compute_cost": {"key": "computeCost", "type": "float"}, + "it_labor_cost": {"key": "itLaborCost", "type": "float"}, + "network_cost": {"key": "networkCost", "type": "float"}, + "ahub_savings": {"key": "ahubSavings", "type": "float"}, + "linux_ahub_savings": {"key": "linuxAhubSavings", "type": "float"}, + "security_cost": {"key": "securityCost", "type": "float"}, + "management_cost_details": {"key": "managementCostDetails", "type": "ManagementCostDetails"}, + "esu_savings": {"key": "esuSavings", "type": "float"}, + "facilities_cost": {"key": "facilitiesCost", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.storage_cost = None + self.compute_cost = None + self.it_labor_cost = None + self.network_cost = None + self.ahub_savings = None + self.linux_ahub_savings = None + self.security_cost = None + self.management_cost_details = None + self.esu_savings = None + self.facilities_cost = None + + +class DiscoveredEntitiesSummary(_serialization.Model): + """Discovered entities summary. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar number_of_servers: Number of web servers. + :vartype number_of_servers: int + :ivar number_of_web_apps: Number of web apps. + :vartype number_of_web_apps: int + :ivar number_of_machines: Number of machines. + :vartype number_of_machines: int + :ivar web_server_summary: Web server summary data. + :vartype web_server_summary: dict[str, int] + :ivar web_app_summary: Web app summary data. + :vartype web_app_summary: dict[str, int] + """ + + _validation = { + "number_of_servers": {"readonly": True}, + "number_of_web_apps": {"readonly": True}, + "number_of_machines": {"readonly": True}, + "web_server_summary": {"readonly": True}, + "web_app_summary": {"readonly": True}, + } + + _attribute_map = { + "number_of_servers": {"key": "numberOfServers", "type": "int"}, + "number_of_web_apps": {"key": "numberOfWebApps", "type": "int"}, + "number_of_machines": {"key": "numberOfMachines", "type": "int"}, + "web_server_summary": {"key": "webServerSummary", "type": "{int}"}, + "web_app_summary": {"key": "webAppSummary", "type": "{int}"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.number_of_servers = None + self.number_of_web_apps = None + self.number_of_machines = None + self.web_server_summary = None + self.web_app_summary = None + + +class DiscoveredEntityLightSummary(_serialization.Model): + """Discovered entity light summary. + + All required parameters must be populated in order to send to server. + + :ivar number_of_servers: Gets or sets the number of servers. Required. + :vartype number_of_servers: int + :ivar number_of_web_apps: Gets or sets the number of web apps. Required. + :vartype number_of_web_apps: int + :ivar number_of_machines: Gets or sets the number of machines. Required. + :vartype number_of_machines: int + """ + + _validation = { + "number_of_servers": {"required": True}, + "number_of_web_apps": {"required": True}, + "number_of_machines": {"required": True}, + } + + _attribute_map = { + "number_of_servers": {"key": "numberOfServers", "type": "int"}, + "number_of_web_apps": {"key": "numberOfWebApps", "type": "int"}, + "number_of_machines": {"key": "numberOfMachines", "type": "int"}, + } + + def __init__( + self, *, number_of_servers: int, number_of_web_apps: int, number_of_machines: int, **kwargs: Any + ) -> None: + """ + :keyword number_of_servers: Gets or sets the number of servers. Required. + :paramtype number_of_servers: int + :keyword number_of_web_apps: Gets or sets the number of web apps. Required. + :paramtype number_of_web_apps: int + :keyword number_of_machines: Gets or sets the number of machines. Required. + :paramtype number_of_machines: int + """ + super().__init__(**kwargs) + self.number_of_servers = number_of_servers + self.number_of_web_apps = number_of_web_apps + self.number_of_machines = number_of_machines + + +class Disk(_serialization.Model): + """A disk discovered on a machine. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar gigabytes_allocated: Gigabytes of storage provisioned for this disk. + :vartype gigabytes_allocated: float + :ivar display_name: User friendly name of the disk. + :vartype display_name: str + """ + + _validation = { + "gigabytes_allocated": {"readonly": True}, + "display_name": {"readonly": True}, + } + + _attribute_map = { + "gigabytes_allocated": {"key": "gigabytesAllocated", "type": "float"}, + "display_name": {"key": "displayName", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.gigabytes_allocated = None + self.display_name = None + + +class DistributionByOperatingSystem(_serialization.Model): + """The distribution by operating system. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar os_classification_type: The Os classification type. + :vartype os_classification_type: str + :ivar count: The number of machines with the OS type classification. + :vartype count: int + """ + + _validation = { + "os_classification_type": {"readonly": True}, + "count": {"readonly": True}, + } + + _attribute_map = { + "os_classification_type": {"key": "osClassificationType", "type": "str"}, + "count": {"key": "count", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.os_classification_type = None + self.count = None + + +class DistributionByType(_serialization.Model): + """Distribution by Type. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: Distribution Type. + :vartype type: str + :ivar count: Distribution Count. + :vartype count: int + """ + + _validation = { + "type": {"readonly": True}, + "count": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "count": {"key": "count", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type = None + self.count = None + + +class DistributionByVirtualization(_serialization.Model): + """The distribution by virtualization. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar virtualization_type: The Virtualization type. + :vartype virtualization_type: str + :ivar count: The number of machines with the Virtualization type classification. + :vartype count: int + """ + + _validation = { + "virtualization_type": {"readonly": True}, + "count": {"readonly": True}, + } + + _attribute_map = { + "virtualization_type": {"key": "virtualizationType", "type": "str"}, + "count": {"key": "count", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.virtualization_type = None + self.count = None + + +class DownloadUrl(_serialization.Model): + """Data model of Download URL for assessment report. + + 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 assessment_report_url: Hyperlink to download report. Required. + :vartype assessment_report_url: str + :ivar expiration_time: Expiry date of download url. Required. + :vartype expiration_time: ~datetime.datetime + """ + + _validation = { + "assessment_report_url": {"required": True, "readonly": True}, + "expiration_time": {"required": True, "readonly": True}, + } + + _attribute_map = { + "assessment_report_url": {"key": "assessmentReportUrl", "type": "str"}, + "expiration_time": {"key": "expirationTime", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.assessment_report_url = None + self.expiration_time = None + + +class EntityUptime(_serialization.Model): + """Entity Uptime. + + :ivar days_per_month: Gets the days per month. + :vartype days_per_month: int + :ivar hours_per_day: Gets the hours per day. + :vartype hours_per_day: int + """ + + _attribute_map = { + "days_per_month": {"key": "daysPerMonth", "type": "int"}, + "hours_per_day": {"key": "hoursPerDay", "type": "int"}, + } + + def __init__( + self, *, days_per_month: Optional[int] = None, hours_per_day: Optional[int] = None, **kwargs: Any + ) -> None: + """ + :keyword days_per_month: Gets the days per month. + :paramtype days_per_month: int + :keyword hours_per_day: Gets the hours per day. + :paramtype hours_per_day: int + """ + super().__init__(**kwargs) + self.days_per_month = days_per_month + self.hours_per_day = hours_per_day + + +class Error(_serialization.Model): + """Error web model class. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Gets the error ID. + :vartype id: int + :ivar code: Gets the error code. + :vartype code: str + :ivar run_as_account_id: Gets the Run as account ID. + :vartype run_as_account_id: str + :ivar appliance_name: Gets the Appliance name. + :vartype appliance_name: str + :ivar message: Gets the error message. + :vartype message: str + :ivar summary_message: Gets the error summary message. + :vartype summary_message: str + :ivar agent_scenario: Gets the agent scenario where this error occurred. + :vartype agent_scenario: str + :ivar possible_causes: Gets the error possible causes. + :vartype possible_causes: str + :ivar recommended_action: Gets the recommended action for the error. + :vartype recommended_action: str + :ivar severity: Gets the error severity. + :vartype severity: str + :ivar message_parameters: Gets the error message parameters. + :vartype message_parameters: dict[str, str] + :ivar updated_time_stamp: Gets the time stamp when the error was updated. + :vartype updated_time_stamp: ~datetime.datetime + :ivar impacted_assessment_type: Gets the type of assessment impacted by this error. + :vartype impacted_assessment_type: str + """ + + _validation = { + "id": {"readonly": True}, + "code": {"readonly": True}, + "run_as_account_id": {"readonly": True}, + "appliance_name": {"readonly": True}, + "message": {"readonly": True}, + "summary_message": {"readonly": True}, + "agent_scenario": {"readonly": True}, + "possible_causes": {"readonly": True}, + "recommended_action": {"readonly": True}, + "severity": {"readonly": True}, + "message_parameters": {"readonly": True}, + "updated_time_stamp": {"readonly": True}, + "impacted_assessment_type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "int"}, + "code": {"key": "code", "type": "str"}, + "run_as_account_id": {"key": "runAsAccountId", "type": "str"}, + "appliance_name": {"key": "applianceName", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "summary_message": {"key": "summaryMessage", "type": "str"}, + "agent_scenario": {"key": "agentScenario", "type": "str"}, + "possible_causes": {"key": "possibleCauses", "type": "str"}, + "recommended_action": {"key": "recommendedAction", "type": "str"}, + "severity": {"key": "severity", "type": "str"}, + "message_parameters": {"key": "messageParameters", "type": "{str}"}, + "updated_time_stamp": {"key": "updatedTimeStamp", "type": "iso-8601"}, + "impacted_assessment_type": {"key": "impactedAssessmentType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.code = None + self.run_as_account_id = None + self.appliance_name = None + self.message = None + self.summary_message = None + self.agent_scenario = None + self.possible_causes = None + self.recommended_action = None + self.severity = None + self.message_parameters = None + self.updated_time_stamp = None + self.impacted_assessment_type = None + + +class ErrorAdditionalInfo(_serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: JSON + """ + + _validation = { + "type": {"readonly": True}, + "info": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(_serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.migrationassessment.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.migrationassessment.models.ErrorAdditionalInfo] + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorDetail]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorDetailAutoGenerated(_serialization.Model): + """Error Details. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar code: Error Code. Required. + :vartype code: str + :ivar message: Description of the error occurred. Required. + :vartype message: str + """ + + _validation = { + "code": {"required": True, "readonly": True}, + "message": {"required": True, "readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code = None + self.message = None + + +class ErrorResponse(_serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.migrationassessment.models.ErrorDetail + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.migrationassessment.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class ErrorSummary(_serialization.Model): + """Error summary containing affected entities for each type of assessment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar assessment_type: Gets the assessment type. Known values are: "Unknown", + "MachineAssessment", "AvsAssessment", "SqlAssessment", and "WebAppAssessment". + :vartype assessment_type: str or ~azure.mgmt.migrationassessment.models.AssessmentType + :ivar count: Gets the affected entity count. + :vartype count: int + """ + + _validation = { + "assessment_type": {"readonly": True}, + "count": {"readonly": True}, + } + + _attribute_map = { + "assessment_type": {"key": "assessmentType", "type": "str"}, + "count": {"key": "count", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.assessment_type = None + self.count = None + + +class EstimatedCostByOffer(_serialization.Model): + """The estimated cost by offer. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar offer_name: The offer name. + :vartype offer_name: str + :ivar cost: Cost for the offer. + :vartype cost: float + """ + + _validation = { + "offer_name": {"readonly": True}, + "cost": {"readonly": True}, + } + + _attribute_map = { + "offer_name": {"key": "offerName", "type": "str"}, + "cost": {"key": "cost", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.offer_name = None + self.cost = None + + +class EstimatedCostByTarget(_serialization.Model): + """Shows the estimated cost by target. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar azure_sql_mi_cost: Azure SQL MI cost. + :vartype azure_sql_mi_cost: float + :ivar azure_sql_db_cost: Azure SQL DB cost. + :vartype azure_sql_db_cost: float + :ivar app_service_cost: Azure App Service cost. + :vartype app_service_cost: float + :ivar app_service_container_cost: Azure App Service Containers cost. + :vartype app_service_container_cost: float + :ivar azure_kubernetes_service_cost: Azure Kubernetes Service cost. + :vartype azure_kubernetes_service_cost: float + """ + + _validation = { + "azure_sql_mi_cost": {"readonly": True}, + "azure_sql_db_cost": {"readonly": True}, + "app_service_cost": {"readonly": True}, + "app_service_container_cost": {"readonly": True}, + "azure_kubernetes_service_cost": {"readonly": True}, + } + + _attribute_map = { + "azure_sql_mi_cost": {"key": "azureSqlMiCost", "type": "float"}, + "azure_sql_db_cost": {"key": "azureSqlDbCost", "type": "float"}, + "app_service_cost": {"key": "appServiceCost", "type": "float"}, + "app_service_container_cost": {"key": "appServiceContainerCost", "type": "float"}, + "azure_kubernetes_service_cost": {"key": "azureKubernetesServiceCost", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.azure_sql_mi_cost = None + self.azure_sql_db_cost = None + self.app_service_cost = None + self.app_service_container_cost = None + self.azure_kubernetes_service_cost = None + + +class EstimatedExternalStorage(_serialization.Model): + """Estimated external storage. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar storage_type: External storage type. Known values are: "Unknown", "None", "AnfStandard", + "AnfPremium", and "AnfUltra". + :vartype storage_type: str or ~azure.mgmt.migrationassessment.models.ExternalStorageType + :ivar total_storage_in_gb: Total storage allocation in GB. + :vartype total_storage_in_gb: float + :ivar storage_utilization: Percent storage utilization. + :vartype storage_utilization: float + :ivar total_storage_cost: Total storage cost. + :vartype total_storage_cost: float + """ + + _validation = { + "storage_type": {"readonly": True}, + "total_storage_in_gb": {"readonly": True}, + "storage_utilization": {"readonly": True}, + "total_storage_cost": {"readonly": True}, + } + + _attribute_map = { + "storage_type": {"key": "storageType", "type": "str"}, + "total_storage_in_gb": {"key": "totalStorageInGB", "type": "float"}, + "storage_utilization": {"key": "storageUtilization", "type": "float"}, + "total_storage_cost": {"key": "totalStorageCost", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.storage_type = None + self.total_storage_in_gb = None + self.storage_utilization = None + self.total_storage_cost = None + + +class EstimatedNetwork(_serialization.Model): + """Estimated network. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar sku_type: Network SKU type. Known values are: "Unknown", "None", and "ExpressRouteUltra". + :vartype sku_type: str or ~azure.mgmt.migrationassessment.models.NetworkSkuType + :ivar cost: Network Sku type cost. + :vartype cost: float + """ + + _validation = { + "sku_type": {"readonly": True}, + "cost": {"readonly": True}, + } + + _attribute_map = { + "sku_type": {"key": "skuType", "type": "str"}, + "cost": {"key": "cost", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.sku_type = None + self.cost = None + + +class EvaluatedAvsMachine(ProxyResource): + """Evaluated AVS machine 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.EvaluatedAvsMachineProperties + """ + + _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": "EvaluatedAvsMachineProperties"}, + } + + def __init__(self, *, properties: Optional["_models.EvaluatedAvsMachineProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.EvaluatedAvsMachineProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class EvaluatedAvsMachineListResult(_serialization.Model): + """The response of a EvaluatedAvsMachine list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The EvaluatedAvsMachine items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.EvaluatedAvsMachine] + :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": "[EvaluatedAvsMachine]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.EvaluatedAvsMachine"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The EvaluatedAvsMachine items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.EvaluatedAvsMachine] + :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 EvaluatedAvsMachineProperties(_serialization.Model): + """Evaluated AVS machine properties class. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar machine_id: Machine Id. + :vartype machine_id: str + :ivar server_name: Server Name. + :vartype server_name: str + :ivar virtualization_type: Virtualization type. + :vartype virtualization_type: str + :ivar activity_state: Activity state. + :vartype activity_state: str + :ivar operating_system_name: Operating System (OS) name. + :vartype operating_system_name: str + :ivar recommended_azure_target: Recommended Azure target. + :vartype recommended_azure_target: str + :ivar qualifying_offer: Qualifying offer. + :vartype qualifying_offer: str + :ivar ready_for_migration: Is machine ready for migration. + :vartype ready_for_migration: str + :ivar support_status: End of Support status. Known values are: "Unknown", "Mainstream", + "Extended", and "OutOfSupport". + :vartype support_status: str or ~azure.mgmt.migrationassessment.models.SupportabilityStatus + """ + + _validation = { + "machine_id": {"readonly": True}, + "server_name": {"readonly": True}, + "virtualization_type": {"readonly": True}, + "activity_state": {"readonly": True}, + "operating_system_name": {"readonly": True}, + "recommended_azure_target": {"readonly": True}, + "qualifying_offer": {"readonly": True}, + "ready_for_migration": {"readonly": True}, + "support_status": {"readonly": True}, + } + + _attribute_map = { + "machine_id": {"key": "machineId", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "virtualization_type": {"key": "virtualizationType", "type": "str"}, + "activity_state": {"key": "activityState", "type": "str"}, + "operating_system_name": {"key": "operatingSystemName", "type": "str"}, + "recommended_azure_target": {"key": "recommendedAzureTarget", "type": "str"}, + "qualifying_offer": {"key": "qualifyingOffer", "type": "str"}, + "ready_for_migration": {"key": "readyForMigration", "type": "str"}, + "support_status": {"key": "supportStatus", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.machine_id = None + self.server_name = None + self.virtualization_type = None + self.activity_state = None + self.operating_system_name = None + self.recommended_azure_target = None + self.qualifying_offer = None + self.ready_for_migration = None + self.support_status = None + + +class EvaluatedMachine(ProxyResource): + """Evaluated machine 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.EvaluatedMachineProperties + """ + + _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": "EvaluatedMachineProperties"}, + } + + def __init__(self, *, properties: Optional["_models.EvaluatedMachineProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.EvaluatedMachineProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class EvaluatedMachineListResult(_serialization.Model): + """The response of a EvaluatedMachine list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The EvaluatedMachine items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.EvaluatedMachine] + :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": "[EvaluatedMachine]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.EvaluatedMachine"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The EvaluatedMachine items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.EvaluatedMachine] + :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 EvaluatedMachineProperties(_serialization.Model): + """Evaluated machine properties class. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar machine_id: Machine Id. + :vartype machine_id: str + :ivar server_name: Server Name. + :vartype server_name: str + :ivar virtualization_type: Virtualization type. + :vartype virtualization_type: str + :ivar activity_state: Activity state. + :vartype activity_state: str + :ivar operating_system_name: Operating System (OS) name. + :vartype operating_system_name: str + :ivar recommended_azure_target: Recommended Azure target. + :vartype recommended_azure_target: str + :ivar qualifying_offer: Qualifying offer. + :vartype qualifying_offer: str + :ivar ready_for_migration: Is machine ready for migration. + :vartype ready_for_migration: str + :ivar support_status: End of Support status. Known values are: "Unknown", "Mainstream", + "Extended", and "OutOfSupport". + :vartype support_status: str or ~azure.mgmt.migrationassessment.models.SupportabilityStatus + """ + + _validation = { + "machine_id": {"readonly": True}, + "server_name": {"readonly": True}, + "virtualization_type": {"readonly": True}, + "activity_state": {"readonly": True}, + "operating_system_name": {"readonly": True}, + "recommended_azure_target": {"readonly": True}, + "qualifying_offer": {"readonly": True}, + "ready_for_migration": {"readonly": True}, + "support_status": {"readonly": True}, + } + + _attribute_map = { + "machine_id": {"key": "machineId", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "virtualization_type": {"key": "virtualizationType", "type": "str"}, + "activity_state": {"key": "activityState", "type": "str"}, + "operating_system_name": {"key": "operatingSystemName", "type": "str"}, + "recommended_azure_target": {"key": "recommendedAzureTarget", "type": "str"}, + "qualifying_offer": {"key": "qualifyingOffer", "type": "str"}, + "ready_for_migration": {"key": "readyForMigration", "type": "str"}, + "support_status": {"key": "supportStatus", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.machine_id = None + self.server_name = None + self.virtualization_type = None + self.activity_state = None + self.operating_system_name = None + self.recommended_azure_target = None + self.qualifying_offer = None + self.ready_for_migration = None + self.support_status = None + + +class EvaluatedSqlEntity(ProxyResource): + """Evaluated sql entity 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.EvaluatedSqlEntityProperties + """ + + _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": "EvaluatedSqlEntityProperties"}, + } + + def __init__(self, *, properties: Optional["_models.EvaluatedSqlEntityProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.EvaluatedSqlEntityProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class EvaluatedSqlEntityListResult(_serialization.Model): + """The response of a EvaluatedSqlEntity list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The EvaluatedSqlEntity items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.EvaluatedSqlEntity] + :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": "[EvaluatedSqlEntity]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.EvaluatedSqlEntity"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The EvaluatedSqlEntity items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.EvaluatedSqlEntity] + :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 EvaluatedSqlEntityProperties(_serialization.Model): + """Evaluated sql entity properties class. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar server_name: Server name. + :vartype server_name: str + :ivar activity_state: Activity state. + :vartype activity_state: str + :ivar sql_version: SQL Server version. + :vartype sql_version: str + :ivar sql_edition: SQL Server edition. + :vartype sql_edition: str + :ivar recommended_azure_target: Recommended Azure target. + :vartype recommended_azure_target: str + :ivar qualifying_offer: Qualifying offer. + :vartype qualifying_offer: str + :ivar ready_for_migration: Is SQL Instance ready for migration. + :vartype ready_for_migration: str + :ivar virtualization_type: The virtualization type. + :vartype virtualization_type: str + :ivar db_count: DB count in instance. + :vartype db_count: int + :ivar support_status: End of Support status. Known values are: "Unknown", "Mainstream", + "Extended", and "OutOfSupport". + :vartype support_status: str or ~azure.mgmt.migrationassessment.models.SupportabilityStatus + """ + + _validation = { + "server_name": {"readonly": True}, + "activity_state": {"readonly": True}, + "sql_version": {"readonly": True}, + "sql_edition": {"readonly": True}, + "recommended_azure_target": {"readonly": True}, + "qualifying_offer": {"readonly": True}, + "ready_for_migration": {"readonly": True}, + "virtualization_type": {"readonly": True}, + "db_count": {"readonly": True}, + "support_status": {"readonly": True}, + } + + _attribute_map = { + "server_name": {"key": "serverName", "type": "str"}, + "activity_state": {"key": "activityState", "type": "str"}, + "sql_version": {"key": "sqlVersion", "type": "str"}, + "sql_edition": {"key": "sqlEdition", "type": "str"}, + "recommended_azure_target": {"key": "recommendedAzureTarget", "type": "str"}, + "qualifying_offer": {"key": "qualifyingOffer", "type": "str"}, + "ready_for_migration": {"key": "readyForMigration", "type": "str"}, + "virtualization_type": {"key": "virtualizationType", "type": "str"}, + "db_count": {"key": "dbCount", "type": "int"}, + "support_status": {"key": "supportStatus", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.server_name = None + self.activity_state = None + self.sql_version = None + self.sql_edition = None + self.recommended_azure_target = None + self.qualifying_offer = None + self.ready_for_migration = None + self.virtualization_type = None + self.db_count = None + self.support_status = None + + +class EvaluatedWebApp(ProxyResource): + """Evaluated web app 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.EvaluatedWebAppProperties + """ + + _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": "EvaluatedWebAppProperties"}, + } + + def __init__(self, *, properties: Optional["_models.EvaluatedWebAppProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.EvaluatedWebAppProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class EvaluatedWebAppListResult(_serialization.Model): + """The response of a EvaluatedWebApp list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The EvaluatedWebApp items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.EvaluatedWebApp] + :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": "[EvaluatedWebApp]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.EvaluatedWebApp"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The EvaluatedWebApp items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.EvaluatedWebApp] + :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 EvaluatedWebAppProperties(_serialization.Model): + """Evaluated web app properties class. + + :ivar recommended_azure_target: Recommended Azure target. + :vartype recommended_azure_target: str + :ivar recommended_azure_sku_name: Recommended Azure SKU name. + :vartype recommended_azure_sku_name: str + :ivar recommended_azure_sku_size: Recommended Azure SKU size. + :vartype recommended_azure_sku_size: str + :ivar server_name: The server name. + :vartype server_name: str + :ivar workload: The workload. + :vartype workload: str + :ivar activity_state: The activity state. + :vartype activity_state: str + :ivar ready_for_migration: Is machine ready for migration. + :vartype ready_for_migration: str + """ + + _attribute_map = { + "recommended_azure_target": {"key": "recommendedAzureTarget", "type": "str"}, + "recommended_azure_sku_name": {"key": "recommendedAzureSkuName", "type": "str"}, + "recommended_azure_sku_size": {"key": "recommendedAzureSkuSize", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "workload": {"key": "workload", "type": "str"}, + "activity_state": {"key": "activityState", "type": "str"}, + "ready_for_migration": {"key": "readyForMigration", "type": "str"}, + } + + def __init__( + self, + *, + recommended_azure_target: Optional[str] = None, + recommended_azure_sku_name: Optional[str] = None, + recommended_azure_sku_size: Optional[str] = None, + server_name: Optional[str] = None, + workload: Optional[str] = None, + activity_state: Optional[str] = None, + ready_for_migration: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword recommended_azure_target: Recommended Azure target. + :paramtype recommended_azure_target: str + :keyword recommended_azure_sku_name: Recommended Azure SKU name. + :paramtype recommended_azure_sku_name: str + :keyword recommended_azure_sku_size: Recommended Azure SKU size. + :paramtype recommended_azure_sku_size: str + :keyword server_name: The server name. + :paramtype server_name: str + :keyword workload: The workload. + :paramtype workload: str + :keyword activity_state: The activity state. + :paramtype activity_state: str + :keyword ready_for_migration: Is machine ready for migration. + :paramtype ready_for_migration: str + """ + super().__init__(**kwargs) + self.recommended_azure_target = recommended_azure_target + self.recommended_azure_sku_name = recommended_azure_sku_name + self.recommended_azure_sku_size = recommended_azure_sku_size + self.server_name = server_name + self.workload = workload + self.activity_state = activity_state + self.ready_for_migration = ready_for_migration + + +class FacilitySettings(_serialization.Model): + """Facility settings. + + :ivar facilities_cost_per_kwh: The facilities cost. + :vartype facilities_cost_per_kwh: float + """ + + _attribute_map = { + "facilities_cost_per_kwh": {"key": "facilitiesCostPerKwh", "type": "float"}, + } + + def __init__(self, *, facilities_cost_per_kwh: Optional[float] = None, **kwargs: Any) -> None: + """ + :keyword facilities_cost_per_kwh: The facilities cost. + :paramtype facilities_cost_per_kwh: float + """ + super().__init__(**kwargs) + self.facilities_cost_per_kwh = facilities_cost_per_kwh + + +class Group(ProxyResource): + """Group 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.GroupProperties + """ + + _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": "GroupProperties"}, + } + + def __init__(self, *, properties: Optional["_models.GroupProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.GroupProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class GroupBodyProperties(_serialization.Model): + """Body properties of group update. + + :ivar operation_type: Whether to add or remove the machines. Known values are: "Add" and + "Remove". + :vartype operation_type: str or ~azure.mgmt.migrationassessment.models.GroupUpdateOperation + :ivar machines: List of machine names that are part of this group. + :vartype machines: list[str] + """ + + _attribute_map = { + "operation_type": {"key": "operationType", "type": "str"}, + "machines": {"key": "machines", "type": "[str]"}, + } + + def __init__( + self, + *, + operation_type: Optional[Union[str, "_models.GroupUpdateOperation"]] = None, + machines: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword operation_type: Whether to add or remove the machines. Known values are: "Add" and + "Remove". + :paramtype operation_type: str or ~azure.mgmt.migrationassessment.models.GroupUpdateOperation + :keyword machines: List of machine names that are part of this group. + :paramtype machines: list[str] + """ + super().__init__(**kwargs) + self.operation_type = operation_type + self.machines = machines + + +class GroupListResult(_serialization.Model): + """The response of a Group list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The Group items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.Group] + :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": "[Group]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.Group"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The Group items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.Group] + :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 GroupProperties(AzureResourceProperties): + """Properties of group resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningState + :ivar group_status: Whether the group has been created and is valid. Known values are: + "Created", "Updated", "Running", "Completed", and "Invalid". + :vartype group_status: str or ~azure.mgmt.migrationassessment.models.GroupStatus + :ivar machine_count: Number of machines part of this group. + :vartype machine_count: int + :ivar assessments: List of References to Assessments created on this group. + :vartype assessments: list[str] + :ivar supported_assessment_types: List of assessment types supported on this group. + :vartype supported_assessment_types: list[str or + ~azure.mgmt.migrationassessment.models.AssessmentType] + :ivar are_assessments_running: If the assessments are in running state. + :vartype are_assessments_running: bool + :ivar created_timestamp: Time when this group was created. Date-Time represented in ISO-8601 + format. + :vartype created_timestamp: ~datetime.datetime + :ivar updated_timestamp: Time when this group was last updated. Date-Time represented in + ISO-8601 format. + :vartype updated_timestamp: ~datetime.datetime + :ivar group_type: The type of group. Known values are: "Default", "Import", and "Import". + :vartype group_type: str or ~azure.mgmt.migrationassessment.models.GroupType + """ + + _validation = { + "group_status": {"readonly": True}, + "machine_count": {"readonly": True}, + "assessments": {"readonly": True}, + "are_assessments_running": {"readonly": True}, + "created_timestamp": {"readonly": True}, + "updated_timestamp": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "group_status": {"key": "groupStatus", "type": "str"}, + "machine_count": {"key": "machineCount", "type": "int"}, + "assessments": {"key": "assessments", "type": "[str]"}, + "supported_assessment_types": {"key": "supportedAssessmentTypes", "type": "[str]"}, + "are_assessments_running": {"key": "areAssessmentsRunning", "type": "bool"}, + "created_timestamp": {"key": "createdTimestamp", "type": "iso-8601"}, + "updated_timestamp": {"key": "updatedTimestamp", "type": "iso-8601"}, + "group_type": {"key": "groupType", "type": "str"}, + } + + def __init__( + self, + *, + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, + supported_assessment_types: Optional[List[Union[str, "_models.AssessmentType"]]] = None, + group_type: Optional[Union[str, "_models.GroupType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :paramtype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningState + :keyword supported_assessment_types: List of assessment types supported on this group. + :paramtype supported_assessment_types: list[str or + ~azure.mgmt.migrationassessment.models.AssessmentType] + :keyword group_type: The type of group. Known values are: "Default", "Import", and "Import". + :paramtype group_type: str or ~azure.mgmt.migrationassessment.models.GroupType + """ + super().__init__(provisioning_state=provisioning_state, **kwargs) + self.group_status = None + self.machine_count = None + self.assessments = None + self.supported_assessment_types = supported_assessment_types + self.are_assessments_running = None + self.created_timestamp = None + self.updated_timestamp = None + self.group_type = group_type + + +class HypervCollector(ProxyResource): + """Hyper-V collector 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.CollectorPropertiesBaseWithAgent + """ + + _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": "CollectorPropertiesBaseWithAgent"}, + } + + def __init__( + self, *, properties: Optional["_models.CollectorPropertiesBaseWithAgent"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.CollectorPropertiesBaseWithAgent + """ + super().__init__(**kwargs) + self.properties = properties + + +class HypervCollectorListResult(_serialization.Model): + """The response of a HypervCollector list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The HypervCollector items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.HypervCollector] + :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": "[HypervCollector]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.HypervCollector"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The HypervCollector items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.HypervCollector] + :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 HypervLicense(_serialization.Model): + """Representation of a licence. + + All required parameters must be populated in order to send to server. + + :ivar license_cost: Cost of a licence. Required. + :vartype license_cost: float + :ivar license_type: HyperV licence type. Required. Known values are: "Unknown", "Datacentre", + and "Standard". + :vartype license_type: str or ~azure.mgmt.migrationassessment.models.HyperVLicenseType + """ + + _validation = { + "license_cost": {"required": True}, + "license_type": {"required": True}, + } + + _attribute_map = { + "license_cost": {"key": "licenseCost", "type": "float"}, + "license_type": {"key": "licenseType", "type": "str"}, + } + + def __init__( + self, *, license_cost: float, license_type: Union[str, "_models.HyperVLicenseType"], **kwargs: Any + ) -> None: + """ + :keyword license_cost: Cost of a licence. Required. + :paramtype license_cost: float + :keyword license_type: HyperV licence type. Required. Known values are: "Unknown", + "Datacentre", and "Standard". + :paramtype license_type: str or ~azure.mgmt.migrationassessment.models.HyperVLicenseType + """ + super().__init__(**kwargs) + self.license_cost = license_cost + self.license_type = license_type + + +class HypervVirtualizationManagementSettings(_serialization.Model): + """HyperV Virtualization Management Settings. + + All required parameters must be populated in order to send to server. + + :ivar number_of_physical_cores_per_license: Number of physical cores per licence. Required. + :vartype number_of_physical_cores_per_license: int + :ivar software_assurance_cost: Software Assurance Cost. Required. + :vartype software_assurance_cost: float + :ivar license_and_support_list: Licence and support list. Required. + :vartype license_and_support_list: list[~azure.mgmt.migrationassessment.models.HypervLicense] + """ + + _validation = { + "number_of_physical_cores_per_license": {"required": True, "minimum": 1}, + "software_assurance_cost": {"required": True}, + "license_and_support_list": {"required": True}, + } + + _attribute_map = { + "number_of_physical_cores_per_license": {"key": "numberOfPhysicalCoresPerLicense", "type": "int"}, + "software_assurance_cost": {"key": "softwareAssuranceCost", "type": "float"}, + "license_and_support_list": {"key": "licenseAndSupportList", "type": "[HypervLicense]"}, + } + + def __init__( + self, + *, + number_of_physical_cores_per_license: int, + software_assurance_cost: float, + license_and_support_list: List["_models.HypervLicense"], + **kwargs: Any + ) -> None: + """ + :keyword number_of_physical_cores_per_license: Number of physical cores per licence. Required. + :paramtype number_of_physical_cores_per_license: int + :keyword software_assurance_cost: Software Assurance Cost. Required. + :paramtype software_assurance_cost: float + :keyword license_and_support_list: Licence and support list. Required. + :paramtype license_and_support_list: list[~azure.mgmt.migrationassessment.models.HypervLicense] + """ + super().__init__(**kwargs) + self.number_of_physical_cores_per_license = number_of_physical_cores_per_license + self.software_assurance_cost = software_assurance_cost + self.license_and_support_list = license_and_support_list + + +class IaasOsDistribution(_serialization.Model): + """Shows the infrastructure as a service machine OS distribution. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar windows: Number of Windows servers. + :vartype windows: int + :ivar linux: Number of Linux servers. + :vartype linux: int + :ivar other: Number of servers neither Windows or Linux. + :vartype other: int + """ + + _validation = { + "windows": {"readonly": True}, + "linux": {"readonly": True}, + "other": {"readonly": True}, + } + + _attribute_map = { + "windows": {"key": "windows", "type": "int"}, + "linux": {"key": "linux", "type": "int"}, + "other": {"key": "other", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.windows = None + self.linux = None + self.other = None + + +class IaasOsLicensingDetails(_serialization.Model): + """The Iaas OS licensing details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar os_type: The OS type. + :vartype os_type: str + :ivar total_cost: The total cost. + :vartype total_cost: float + :ivar decomission_cost: The decommission cost. + :vartype decomission_cost: float + """ + + _validation = { + "os_type": {"readonly": True}, + "total_cost": {"readonly": True}, + "decomission_cost": {"readonly": True}, + } + + _attribute_map = { + "os_type": {"key": "osType", "type": "str"}, + "total_cost": {"key": "totalCost", "type": "float"}, + "decomission_cost": {"key": "decomissionCost", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.os_type = None + self.total_cost = None + self.decomission_cost = None + + +class IaasSummary(ProxyResource): + """Iaas summary REST 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.IaasSummaryProperties + """ + + _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": "IaasSummaryProperties"}, + } + + def __init__(self, *, properties: Optional["_models.IaasSummaryProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.IaasSummaryProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class IaasSummaryListResult(_serialization.Model): + """The response of a IaasSummary list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The IaasSummary items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.IaasSummary] + :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": "[IaasSummary]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.IaasSummary"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The IaasSummary items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.IaasSummary] + :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 IaasSummaryProperties(_serialization.Model): + """Iaas summary properties class. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar azure_iaas_summary: The Azure IaaS summary. + :vartype azure_iaas_summary: ~azure.mgmt.migrationassessment.models.AzureIaasSummary + :ivar on_premises_iaas_summary: The on premises IaaS summary. + :vartype on_premises_iaas_summary: ~azure.mgmt.migrationassessment.models.OnPremisesIaasSummary + """ + + _validation = { + "azure_iaas_summary": {"readonly": True}, + "on_premises_iaas_summary": {"readonly": True}, + } + + _attribute_map = { + "azure_iaas_summary": {"key": "azureIaasSummary", "type": "AzureIaasSummary"}, + "on_premises_iaas_summary": {"key": "onPremisesIaasSummary", "type": "OnPremisesIaasSummary"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.azure_iaas_summary = None + self.on_premises_iaas_summary = None + + +class ImpactedAssessmentObject(_serialization.Model): + """Class representing the impacted objects. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar object_name: Gets the object name. + :vartype object_name: str + :ivar object_type: Gets the object type. + :vartype object_type: str + """ + + _validation = { + "object_name": {"readonly": True}, + "object_type": {"readonly": True}, + } + + _attribute_map = { + "object_name": {"key": "objectName", "type": "str"}, + "object_type": {"key": "objectType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.object_name = None + self.object_type = None + + +class ImportCollector(ProxyResource): + """Import collector 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.CollectorPropertiesBase + """ + + _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": "CollectorPropertiesBase"}, + } + + def __init__(self, *, properties: Optional["_models.CollectorPropertiesBase"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.CollectorPropertiesBase + """ + super().__init__(**kwargs) + self.properties = properties + + +class ImportCollectorListResult(_serialization.Model): + """The response of a ImportCollector list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The ImportCollector items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.ImportCollector] + :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": "[ImportCollector]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.ImportCollector"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The ImportCollector items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.ImportCollector] + :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 LaborSettings(_serialization.Model): + """Labour settings. + + All required parameters must be populated in order to send to server. + + :ivar physical_servers_per_admin: Physical servers per administrator. Required. + :vartype physical_servers_per_admin: int + :ivar virtual_machines_per_admin: Virtual machines per administrator. Required. + :vartype virtual_machines_per_admin: int + :ivar hourly_admin_cost: Hourly administrator cost. Required. + :vartype hourly_admin_cost: float + """ + + _validation = { + "physical_servers_per_admin": {"required": True, "minimum": 1}, + "virtual_machines_per_admin": {"required": True, "minimum": 1}, + "hourly_admin_cost": {"required": True}, + } + + _attribute_map = { + "physical_servers_per_admin": {"key": "physicalServersPerAdmin", "type": "int"}, + "virtual_machines_per_admin": {"key": "virtualMachinesPerAdmin", "type": "int"}, + "hourly_admin_cost": {"key": "hourlyAdminCost", "type": "float"}, + } + + def __init__( + self, + *, + physical_servers_per_admin: int, + virtual_machines_per_admin: int, + hourly_admin_cost: float, + **kwargs: Any + ) -> None: + """ + :keyword physical_servers_per_admin: Physical servers per administrator. Required. + :paramtype physical_servers_per_admin: int + :keyword virtual_machines_per_admin: Virtual machines per administrator. Required. + :paramtype virtual_machines_per_admin: int + :keyword hourly_admin_cost: Hourly administrator cost. Required. + :paramtype hourly_admin_cost: float + """ + super().__init__(**kwargs) + self.physical_servers_per_admin = physical_servers_per_admin + self.virtual_machines_per_admin = virtual_machines_per_admin + self.hourly_admin_cost = hourly_admin_cost + + +class LinuxServerLicensingSettings(_serialization.Model): + """Linux Server licensing settings. + + All required parameters must be populated in order to send to server. + + :ivar license_cost: Licence Cost. Required. + :vartype license_cost: float + """ + + _validation = { + "license_cost": {"required": True}, + } + + _attribute_map = { + "license_cost": {"key": "licenseCost", "type": "float"}, + } + + def __init__(self, *, license_cost: float, **kwargs: Any) -> None: + """ + :keyword license_cost: Licence Cost. Required. + :paramtype license_cost: float + """ + super().__init__(**kwargs) + self.license_cost = license_cost + + +class Machine(ProxyResource): + """Machine 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.MachineProperties + """ + + _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": "MachineProperties"}, + } + + def __init__(self, *, properties: Optional["_models.MachineProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.MachineProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class MachineAssessmentProperties(AzureResourceProperties): + """Properties of an assessment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningState + :ivar assessment_error_summary: Gets or sets the assessment error summary. + This is the number of + machines affected by each type of error in this assessment. + :vartype assessment_error_summary: dict[str, int] + :ivar monthly_ultra_storage_cost: Gets or sets the aggregate ultra storage cost for all + machines in the + assessment. + :vartype monthly_ultra_storage_cost: float + :ivar cost_components: Gets the collection of cost components. + :vartype cost_components: list[~azure.mgmt.migrationassessment.models.CostComponent] + :ivar ea_subscription_id: Gets or sets enterprise agreement subscription id. + :vartype ea_subscription_id: str + :ivar azure_pricing_tier: Gets or sets Azure Pricing Tier - Free, Basic, etc. Known values are: + "Standard" and "Basic". + :vartype azure_pricing_tier: str or ~azure.mgmt.migrationassessment.models.AzurePricingTier + :ivar azure_storage_redundancy: Gets or sets the Azure Storage Redundancy. Example: Locally + Redundant Storage. Known values are: "Unknown", "LocallyRedundant", "ZoneRedundant", + "GeoRedundant", and "ReadAccessGeoRedundant". + :vartype azure_storage_redundancy: str or + ~azure.mgmt.migrationassessment.models.AzureStorageRedundancy + :ivar reserved_instance: Gets or sets the Azure Reserved Instance - 1-Year, 3-Year. Known + values are: "None", "RI1Year", and "RI3Year". + :vartype reserved_instance: str or ~azure.mgmt.migrationassessment.models.AzureReservedInstance + :ivar azure_hybrid_use_benefit: Gets or sets the user configurable setting to display the azure + hybrid use + benefit. Known values are: "Unknown", "Yes", and "No". + :vartype azure_hybrid_use_benefit: str or + ~azure.mgmt.migrationassessment.models.AzureHybridUseBenefit + :ivar linux_azure_hybrid_use_benefit: Gets or sets the user configurable setting to display the + linux azure hybrid use + benefit. Known values are: "Unknown", "Yes", and "No". + :vartype linux_azure_hybrid_use_benefit: str or + ~azure.mgmt.migrationassessment.models.AzureHybridUseBenefit + :ivar azure_disk_types: Gets or sets the azure storage type. Premium, Standard etc. + :vartype azure_disk_types: list[str or ~azure.mgmt.migrationassessment.models.AzureDiskType] + :ivar azure_vm_families: Gets or sets the Azure VM families. + :vartype azure_vm_families: list[str or ~azure.mgmt.migrationassessment.models.AzureVmFamily] + :ivar distribution_by_support_status: Gets the distribution of sqlInstances by support status. + :vartype distribution_by_support_status: dict[str, int] + :ivar distribution_by_service_pack_insight: Gets the distribution distribution of sqlInstances + by service pack insight. + :vartype distribution_by_service_pack_insight: dict[str, int] + :ivar distribution_by_os_name: Gets the distribution by os name. + :vartype distribution_by_os_name: dict[str, int] + :ivar monthly_compute_cost: Gets or sets the aggregate Compute Cost for all machines in the + assessment. + :vartype monthly_compute_cost: float + :ivar monthly_bandwidth_cost: Gets or sets the aggregate Bandwidth Cost for all machines in the + assessment. + :vartype monthly_bandwidth_cost: float + :ivar monthly_storage_cost: Gets or sets the aggregate Storage Cost for all machines in the + assessment. + :vartype monthly_storage_cost: float + :ivar monthly_premium_storage_cost: Gets or sets the aggregate premium storage cost for all + machines in the + assessment. + :vartype monthly_premium_storage_cost: float + :ivar monthly_standard_ssd_storage_cost: Gets or sets the aggregate standard SSD storage cost + for all the machines in + the assessment. + :vartype monthly_standard_ssd_storage_cost: float + :ivar suitability_summary: Gets or sets the Cloud suitability summary for all the machines in + the + assessment. + :vartype suitability_summary: dict[str, int] + :ivar number_of_machines: Gets or sets the Number of machines part of the assessment. + :vartype number_of_machines: int + :ivar vm_uptime: Gets or sets the duration for which the VMs are up in the on-premises + environment. + :vartype vm_uptime: ~azure.mgmt.migrationassessment.models.VmUptime + :ivar group_type: Gets the group type for the assessment. Known values are: "Default", + "Import", and "Import". + :vartype group_type: str or ~azure.mgmt.migrationassessment.models.GroupType + :ivar assessment_type: Assessment type of the assessment. Known values are: "Unknown", + "MachineAssessment", "AvsAssessment", "SqlAssessment", and "WebAppAssessment". + :vartype assessment_type: str or ~azure.mgmt.migrationassessment.models.AssessmentType + :ivar azure_location: Azure Location or Azure region where to which the machines will be + migrated. + :vartype azure_location: str + :ivar azure_offer_code: Azure Offer Code. Known values are: "Unknown", "MSAZR0003P", + "MSAZR0044P", "MSAZR0059P", "MSAZR0060P", "MSAZR0062P", "MSAZR0063P", "MSAZR0064P", + "MSAZR0029P", "MSAZR0022P", "MSAZR0023P", "MSAZR0148P", "MSAZR0025P", "MSAZR0036P", + "MSAZR0120P", "MSAZR0121P", "MSAZR0122P", "MSAZR0123P", "MSAZR0124P", "MSAZR0125P", + "MSAZR0126P", "MSAZR0127P", "MSAZR0128P", "MSAZR0129P", "MSAZR0130P", "MSAZR0111P", + "MSAZR0144P", "MSAZR0149P", "MSMCAZR0044P", "MSMCAZR0059P", "MSMCAZR0060P", "MSMCAZR0063P", + "MSMCAZR0120P", "MSMCAZR0121P", "MSMCAZR0125P", "MSMCAZR0128P", "MSAZRDE0003P", "MSAZRDE0044P", + "MSAZRUSGOV0003P", "EA", "MSAZR0243P", "SavingsPlan1Year", and "SavingsPlan3Year". + :vartype azure_offer_code: str or ~azure.mgmt.migrationassessment.models.AzureOfferCode + :ivar currency: Currency in which prices should be reported. Known values are: "Unknown", + "USD", "DKK", "CAD", "IDR", "JPY", "KRW", "NZD", "NOK", "RUB", "SAR", "ZAR", "SEK", "TRY", + "GBP", "MXN", "MYR", "INR", "HKD", "BRL", "TWD", "EUR", "CHF", "ARS", "AUD", "CNY", and "TRY". + :vartype currency: str or ~azure.mgmt.migrationassessment.models.AzureCurrency + :ivar scaling_factor: Percentage of buffer that user wants on performance metrics when + recommending + Azure sizes. + :vartype scaling_factor: float + :ivar percentile: Percentile of the utilization data values to be considered while assessing + machines. Known values are: "Percentile50", "Percentile90", "Percentile95", and + "Percentile99". + :vartype percentile: str or ~azure.mgmt.migrationassessment.models.Percentile + :ivar time_range: Time Range for which the historic utilization data should be considered for + assessment. Known values are: "Day", "Week", "Month", and "Custom". + :vartype time_range: str or ~azure.mgmt.migrationassessment.models.TimeRange + :ivar perf_data_start_time: Gets or sets the start time to consider performance data for + assessment. + :vartype perf_data_start_time: ~datetime.datetime + :ivar perf_data_end_time: Gets or sets the end time to consider performance data for + assessment. + :vartype perf_data_end_time: ~datetime.datetime + :ivar stage: User configurable setting to display the Stage of Assessment. Known values are: + "InProgress", "UnderReview", and "Approved". + :vartype stage: str or ~azure.mgmt.migrationassessment.models.AssessmentStage + :ivar discount_percentage: Custom discount percentage. + :vartype discount_percentage: float + :ivar sizing_criterion: Assessment sizing criterion. Known values are: "PerformanceBased" and + "AsOnPremises". + :vartype sizing_criterion: str or + ~azure.mgmt.migrationassessment.models.AssessmentSizingCriterion + :ivar confidence_rating_in_percentage: Confidence Rating in Percentage. + :vartype confidence_rating_in_percentage: float + :ivar prices_timestamp: Last time when rates were queried. + :vartype prices_timestamp: ~datetime.datetime + :ivar created_timestamp: Date and Time when assessment was created. + :vartype created_timestamp: ~datetime.datetime + :ivar updated_timestamp: Date and Time when assessment was last updated. + :vartype updated_timestamp: ~datetime.datetime + :ivar status: Whether assessment is in valid state and all machines have been assessed. Known + values are: "Created", "Updated", "Running", "Completed", "Invalid", "OutOfSync", "OutDated", + and "Deleted". + :vartype status: str or ~azure.mgmt.migrationassessment.models.AssessmentStatus + :ivar schema_version: Schema version. + :vartype schema_version: str + """ + + _validation = { + "assessment_error_summary": {"readonly": True}, + "monthly_ultra_storage_cost": {"readonly": True}, + "cost_components": {"readonly": True}, + "distribution_by_support_status": {"readonly": True}, + "distribution_by_service_pack_insight": {"readonly": True}, + "distribution_by_os_name": {"readonly": True}, + "monthly_compute_cost": {"readonly": True}, + "monthly_bandwidth_cost": {"readonly": True}, + "monthly_storage_cost": {"readonly": True}, + "monthly_premium_storage_cost": {"readonly": True}, + "monthly_standard_ssd_storage_cost": {"readonly": True}, + "suitability_summary": {"readonly": True}, + "number_of_machines": {"readonly": True}, + "group_type": {"readonly": True}, + "assessment_type": {"readonly": True}, + "stage": {"readonly": True}, + "confidence_rating_in_percentage": {"readonly": True}, + "prices_timestamp": {"readonly": True}, + "created_timestamp": {"readonly": True}, + "updated_timestamp": {"readonly": True}, + "status": {"readonly": True}, + "schema_version": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "assessment_error_summary": {"key": "assessmentErrorSummary", "type": "{int}"}, + "monthly_ultra_storage_cost": {"key": "monthlyUltraStorageCost", "type": "float"}, + "cost_components": {"key": "costComponents", "type": "[CostComponent]"}, + "ea_subscription_id": {"key": "eaSubscriptionId", "type": "str"}, + "azure_pricing_tier": {"key": "azurePricingTier", "type": "str"}, + "azure_storage_redundancy": {"key": "azureStorageRedundancy", "type": "str"}, + "reserved_instance": {"key": "reservedInstance", "type": "str"}, + "azure_hybrid_use_benefit": {"key": "azureHybridUseBenefit", "type": "str"}, + "linux_azure_hybrid_use_benefit": {"key": "linuxAzureHybridUseBenefit", "type": "str"}, + "azure_disk_types": {"key": "azureDiskTypes", "type": "[str]"}, + "azure_vm_families": {"key": "azureVmFamilies", "type": "[str]"}, + "distribution_by_support_status": {"key": "distributionBySupportStatus", "type": "{int}"}, + "distribution_by_service_pack_insight": {"key": "distributionByServicePackInsight", "type": "{int}"}, + "distribution_by_os_name": {"key": "distributionByOsName", "type": "{int}"}, + "monthly_compute_cost": {"key": "monthlyComputeCost", "type": "float"}, + "monthly_bandwidth_cost": {"key": "monthlyBandwidthCost", "type": "float"}, + "monthly_storage_cost": {"key": "monthlyStorageCost", "type": "float"}, + "monthly_premium_storage_cost": {"key": "monthlyPremiumStorageCost", "type": "float"}, + "monthly_standard_ssd_storage_cost": {"key": "monthlyStandardSsdStorageCost", "type": "float"}, + "suitability_summary": {"key": "suitabilitySummary", "type": "{int}"}, + "number_of_machines": {"key": "numberOfMachines", "type": "int"}, + "vm_uptime": {"key": "vmUptime", "type": "VmUptime"}, + "group_type": {"key": "groupType", "type": "str"}, + "assessment_type": {"key": "assessmentType", "type": "str"}, + "azure_location": {"key": "azureLocation", "type": "str"}, + "azure_offer_code": {"key": "azureOfferCode", "type": "str"}, + "currency": {"key": "currency", "type": "str"}, + "scaling_factor": {"key": "scalingFactor", "type": "float"}, + "percentile": {"key": "percentile", "type": "str"}, + "time_range": {"key": "timeRange", "type": "str"}, + "perf_data_start_time": {"key": "perfDataStartTime", "type": "iso-8601"}, + "perf_data_end_time": {"key": "perfDataEndTime", "type": "iso-8601"}, + "stage": {"key": "stage", "type": "str"}, + "discount_percentage": {"key": "discountPercentage", "type": "float"}, + "sizing_criterion": {"key": "sizingCriterion", "type": "str"}, + "confidence_rating_in_percentage": {"key": "confidenceRatingInPercentage", "type": "float"}, + "prices_timestamp": {"key": "pricesTimestamp", "type": "iso-8601"}, + "created_timestamp": {"key": "createdTimestamp", "type": "iso-8601"}, + "updated_timestamp": {"key": "updatedTimestamp", "type": "iso-8601"}, + "status": {"key": "status", "type": "str"}, + "schema_version": {"key": "schemaVersion", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, + ea_subscription_id: Optional[str] = None, + azure_pricing_tier: Optional[Union[str, "_models.AzurePricingTier"]] = None, + azure_storage_redundancy: Optional[Union[str, "_models.AzureStorageRedundancy"]] = None, + reserved_instance: Optional[Union[str, "_models.AzureReservedInstance"]] = None, + azure_hybrid_use_benefit: Optional[Union[str, "_models.AzureHybridUseBenefit"]] = None, + linux_azure_hybrid_use_benefit: Optional[Union[str, "_models.AzureHybridUseBenefit"]] = None, + azure_disk_types: Optional[List[Union[str, "_models.AzureDiskType"]]] = None, + azure_vm_families: Optional[List[Union[str, "_models.AzureVmFamily"]]] = None, + vm_uptime: Optional["_models.VmUptime"] = None, + azure_location: Optional[str] = None, + azure_offer_code: Optional[Union[str, "_models.AzureOfferCode"]] = None, + currency: Optional[Union[str, "_models.AzureCurrency"]] = None, + scaling_factor: Optional[float] = None, + percentile: Optional[Union[str, "_models.Percentile"]] = None, + time_range: Optional[Union[str, "_models.TimeRange"]] = None, + perf_data_start_time: Optional[datetime.datetime] = None, + perf_data_end_time: Optional[datetime.datetime] = None, + discount_percentage: Optional[float] = None, + sizing_criterion: Optional[Union[str, "_models.AssessmentSizingCriterion"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :paramtype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningState + :keyword ea_subscription_id: Gets or sets enterprise agreement subscription id. + :paramtype ea_subscription_id: str + :keyword azure_pricing_tier: Gets or sets Azure Pricing Tier - Free, Basic, etc. Known values + are: "Standard" and "Basic". + :paramtype azure_pricing_tier: str or ~azure.mgmt.migrationassessment.models.AzurePricingTier + :keyword azure_storage_redundancy: Gets or sets the Azure Storage Redundancy. Example: Locally + Redundant Storage. Known values are: "Unknown", "LocallyRedundant", "ZoneRedundant", + "GeoRedundant", and "ReadAccessGeoRedundant". + :paramtype azure_storage_redundancy: str or + ~azure.mgmt.migrationassessment.models.AzureStorageRedundancy + :keyword reserved_instance: Gets or sets the Azure Reserved Instance - 1-Year, 3-Year. Known + values are: "None", "RI1Year", and "RI3Year". + :paramtype reserved_instance: str or + ~azure.mgmt.migrationassessment.models.AzureReservedInstance + :keyword azure_hybrid_use_benefit: Gets or sets the user configurable setting to display the + azure hybrid use + benefit. Known values are: "Unknown", "Yes", and "No". + :paramtype azure_hybrid_use_benefit: str or + ~azure.mgmt.migrationassessment.models.AzureHybridUseBenefit + :keyword linux_azure_hybrid_use_benefit: Gets or sets the user configurable setting to display + the linux azure hybrid use + benefit. Known values are: "Unknown", "Yes", and "No". + :paramtype linux_azure_hybrid_use_benefit: str or + ~azure.mgmt.migrationassessment.models.AzureHybridUseBenefit + :keyword azure_disk_types: Gets or sets the azure storage type. Premium, Standard etc. + :paramtype azure_disk_types: list[str or ~azure.mgmt.migrationassessment.models.AzureDiskType] + :keyword azure_vm_families: Gets or sets the Azure VM families. + :paramtype azure_vm_families: list[str or ~azure.mgmt.migrationassessment.models.AzureVmFamily] + :keyword vm_uptime: Gets or sets the duration for which the VMs are up in the on-premises + environment. + :paramtype vm_uptime: ~azure.mgmt.migrationassessment.models.VmUptime + :keyword azure_location: Azure Location or Azure region where to which the machines will be + migrated. + :paramtype azure_location: str + :keyword azure_offer_code: Azure Offer Code. Known values are: "Unknown", "MSAZR0003P", + "MSAZR0044P", "MSAZR0059P", "MSAZR0060P", "MSAZR0062P", "MSAZR0063P", "MSAZR0064P", + "MSAZR0029P", "MSAZR0022P", "MSAZR0023P", "MSAZR0148P", "MSAZR0025P", "MSAZR0036P", + "MSAZR0120P", "MSAZR0121P", "MSAZR0122P", "MSAZR0123P", "MSAZR0124P", "MSAZR0125P", + "MSAZR0126P", "MSAZR0127P", "MSAZR0128P", "MSAZR0129P", "MSAZR0130P", "MSAZR0111P", + "MSAZR0144P", "MSAZR0149P", "MSMCAZR0044P", "MSMCAZR0059P", "MSMCAZR0060P", "MSMCAZR0063P", + "MSMCAZR0120P", "MSMCAZR0121P", "MSMCAZR0125P", "MSMCAZR0128P", "MSAZRDE0003P", "MSAZRDE0044P", + "MSAZRUSGOV0003P", "EA", "MSAZR0243P", "SavingsPlan1Year", and "SavingsPlan3Year". + :paramtype azure_offer_code: str or ~azure.mgmt.migrationassessment.models.AzureOfferCode + :keyword currency: Currency in which prices should be reported. Known values are: "Unknown", + "USD", "DKK", "CAD", "IDR", "JPY", "KRW", "NZD", "NOK", "RUB", "SAR", "ZAR", "SEK", "TRY", + "GBP", "MXN", "MYR", "INR", "HKD", "BRL", "TWD", "EUR", "CHF", "ARS", "AUD", "CNY", and "TRY". + :paramtype currency: str or ~azure.mgmt.migrationassessment.models.AzureCurrency + :keyword scaling_factor: Percentage of buffer that user wants on performance metrics when + recommending + Azure sizes. + :paramtype scaling_factor: float + :keyword percentile: Percentile of the utilization data values to be considered while assessing + machines. Known values are: "Percentile50", "Percentile90", "Percentile95", and + "Percentile99". + :paramtype percentile: str or ~azure.mgmt.migrationassessment.models.Percentile + :keyword time_range: Time Range for which the historic utilization data should be considered + for + assessment. Known values are: "Day", "Week", "Month", and "Custom". + :paramtype time_range: str or ~azure.mgmt.migrationassessment.models.TimeRange + :keyword perf_data_start_time: Gets or sets the start time to consider performance data for + assessment. + :paramtype perf_data_start_time: ~datetime.datetime + :keyword perf_data_end_time: Gets or sets the end time to consider performance data for + assessment. + :paramtype perf_data_end_time: ~datetime.datetime + :keyword discount_percentage: Custom discount percentage. + :paramtype discount_percentage: float + :keyword sizing_criterion: Assessment sizing criterion. Known values are: "PerformanceBased" + and "AsOnPremises". + :paramtype sizing_criterion: str or + ~azure.mgmt.migrationassessment.models.AssessmentSizingCriterion + """ + super().__init__(provisioning_state=provisioning_state, **kwargs) + self.assessment_error_summary = None + self.monthly_ultra_storage_cost = None + self.cost_components = None + self.ea_subscription_id = ea_subscription_id + self.azure_pricing_tier = azure_pricing_tier + self.azure_storage_redundancy = azure_storage_redundancy + self.reserved_instance = reserved_instance + self.azure_hybrid_use_benefit = azure_hybrid_use_benefit + self.linux_azure_hybrid_use_benefit = linux_azure_hybrid_use_benefit + self.azure_disk_types = azure_disk_types + self.azure_vm_families = azure_vm_families + self.distribution_by_support_status = None + self.distribution_by_service_pack_insight = None + self.distribution_by_os_name = None + self.monthly_compute_cost = None + self.monthly_bandwidth_cost = None + self.monthly_storage_cost = None + self.monthly_premium_storage_cost = None + self.monthly_standard_ssd_storage_cost = None + self.suitability_summary = None + self.number_of_machines = None + self.vm_uptime = vm_uptime + self.group_type = None + self.assessment_type = None + self.azure_location = azure_location + self.azure_offer_code = azure_offer_code + self.currency = currency + self.scaling_factor = scaling_factor + self.percentile = percentile + self.time_range = time_range + self.perf_data_start_time = perf_data_start_time + self.perf_data_end_time = perf_data_end_time + self.stage = None + self.discount_percentage = discount_percentage + self.sizing_criterion = sizing_criterion + self.confidence_rating_in_percentage = None + self.prices_timestamp = None + self.created_timestamp = None + self.updated_timestamp = None + self.status = None + self.schema_version = None + + +class MachineListResult(_serialization.Model): + """The response of a Machine list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The Machine items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.Machine] + :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": "[Machine]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.Machine"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The Machine items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.Machine] + :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 MachineProperties(_serialization.Model): + """Properties of a machine. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar workload_summary: Gets or sets workload summary. + :vartype workload_summary: ~azure.mgmt.migrationassessment.models.WorkloadSummary + :ivar errors: List of errors for this machine. + :vartype errors: list[~azure.mgmt.migrationassessment.models.Error] + :ivar host_processor: Gets Processor details of the host. + :vartype host_processor: ~azure.mgmt.migrationassessment.models.ProcessorInfo + :ivar product_support_status: Gets the product support status related details. + :vartype product_support_status: ~azure.mgmt.migrationassessment.models.ProductSupportStatus + :ivar discovery_machine_arm_id: Site id of machine discovered in private data center. + :vartype discovery_machine_arm_id: str + :ivar datacenter_management_server_arm_id: The data center management server ARM Id for the + machine. + :vartype datacenter_management_server_arm_id: str + :ivar datacenter_management_server_name: The data center management server name for the + machine. + :vartype datacenter_management_server_name: str + :ivar boot_type: Boot type of machine discovered in private data center. Known values are: + "Unknown", "EFI", "BIOS", and "NotSpecified". + :vartype boot_type: str or ~azure.mgmt.migrationassessment.models.MachineBootType + :ivar display_name: Display Name of the Machine. + :vartype display_name: str + :ivar megabytes_of_memory: Megabytes of memory found allocated for the machine in private data + center. + :vartype megabytes_of_memory: float + :ivar number_of_cores: Number of CPU cores found on the machine. + :vartype number_of_cores: int + :ivar operating_system_type: Operating system as reported by datacenter management solution. + :vartype operating_system_type: str + :ivar operating_system_name: Operating system as reported by datacenter management solution. + :vartype operating_system_name: str + :ivar operating_system_version: Operating system version as reported by datacenter management + solution. + :vartype operating_system_version: str + :ivar description: Description for the machine. + :vartype description: str + :ivar created_timestamp: When was machine first created. + :vartype created_timestamp: ~datetime.datetime + :ivar disks: Disks attached to the machine discovered in private data center. + :vartype disks: dict[str, ~azure.mgmt.migrationassessment.models.Disk] + :ivar groups: Gets the References to the groups that this machine is member of. + :vartype groups: list[str] + :ivar network_adapters: Network adapters attached to the machine discovered in private data + center. + :vartype network_adapters: dict[str, ~azure.mgmt.migrationassessment.models.NetworkAdapter] + :ivar sql_instances: SQL instances discovered on the machine. + :vartype sql_instances: list[str] + :ivar web_applications: Web applications discovered on the machine. + :vartype web_applications: list[str] + :ivar updated_timestamp: When was machine last updated. + :vartype updated_timestamp: ~datetime.datetime + """ + + _validation = { + "workload_summary": {"readonly": True}, + "errors": {"readonly": True}, + "host_processor": {"readonly": True}, + "product_support_status": {"readonly": True}, + "discovery_machine_arm_id": {"readonly": True}, + "datacenter_management_server_arm_id": {"readonly": True}, + "datacenter_management_server_name": {"readonly": True}, + "boot_type": {"readonly": True}, + "display_name": {"readonly": True}, + "megabytes_of_memory": {"readonly": True}, + "number_of_cores": {"readonly": True}, + "operating_system_type": {"readonly": True}, + "operating_system_name": {"readonly": True}, + "operating_system_version": {"readonly": True}, + "description": {"readonly": True}, + "created_timestamp": {"readonly": True}, + "disks": {"readonly": True}, + "groups": {"readonly": True}, + "network_adapters": {"readonly": True}, + "sql_instances": {"readonly": True}, + "web_applications": {"readonly": True}, + "updated_timestamp": {"readonly": True}, + } + + _attribute_map = { + "workload_summary": {"key": "workloadSummary", "type": "WorkloadSummary"}, + "errors": {"key": "errors", "type": "[Error]"}, + "host_processor": {"key": "hostProcessor", "type": "ProcessorInfo"}, + "product_support_status": {"key": "productSupportStatus", "type": "ProductSupportStatus"}, + "discovery_machine_arm_id": {"key": "discoveryMachineArmId", "type": "str"}, + "datacenter_management_server_arm_id": {"key": "datacenterManagementServerArmId", "type": "str"}, + "datacenter_management_server_name": {"key": "datacenterManagementServerName", "type": "str"}, + "boot_type": {"key": "bootType", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "megabytes_of_memory": {"key": "megabytesOfMemory", "type": "float"}, + "number_of_cores": {"key": "numberOfCores", "type": "int"}, + "operating_system_type": {"key": "operatingSystemType", "type": "str"}, + "operating_system_name": {"key": "operatingSystemName", "type": "str"}, + "operating_system_version": {"key": "operatingSystemVersion", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "created_timestamp": {"key": "createdTimestamp", "type": "iso-8601"}, + "disks": {"key": "disks", "type": "{Disk}"}, + "groups": {"key": "groups", "type": "[str]"}, + "network_adapters": {"key": "networkAdapters", "type": "{NetworkAdapter}"}, + "sql_instances": {"key": "sqlInstances", "type": "[str]"}, + "web_applications": {"key": "webApplications", "type": "[str]"}, + "updated_timestamp": {"key": "updatedTimestamp", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.workload_summary = None + self.errors = None + self.host_processor = None + self.product_support_status = None + self.discovery_machine_arm_id = None + self.datacenter_management_server_arm_id = None + self.datacenter_management_server_name = None + self.boot_type = None + self.display_name = None + self.megabytes_of_memory = None + self.number_of_cores = None + self.operating_system_type = None + self.operating_system_name = None + self.operating_system_version = None + self.description = None + self.created_timestamp = None + self.disks = None + self.groups = None + self.network_adapters = None + self.sql_instances = None + self.web_applications = None + self.updated_timestamp = None + + +class ManagementCostComponent(_serialization.Model): + """Management Cost Component. + + All required parameters must be populated in order to send to server. + + :ivar name: Name of Management Cost Component. Required. Known values are: "Unknown", + "SystemCenterLicenseCost", "VSphereManagementCost", "ThirdPartyManagementCost", + "OtherMonitoringCost", "OtherDataProtectionCost", "OtherPatchingCost", "AzureMonitoringCost", + "AzurePatchingCost", "AzureDataProtectionCost", "AzureArcMonitoringCost", and + "AzureArcPatchingCost". + :vartype name: str or ~azure.mgmt.migrationassessment.models.ManagementCostComponentName + :ivar value: Cost of Management Component. + :vartype value: float + """ + + _validation = { + "name": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "float"}, + } + + def __init__( + self, *, name: Union[str, "_models.ManagementCostComponentName"], value: Optional[float] = None, **kwargs: Any + ) -> None: + """ + :keyword name: Name of Management Cost Component. Required. Known values are: "Unknown", + "SystemCenterLicenseCost", "VSphereManagementCost", "ThirdPartyManagementCost", + "OtherMonitoringCost", "OtherDataProtectionCost", "OtherPatchingCost", "AzureMonitoringCost", + "AzurePatchingCost", "AzureDataProtectionCost", "AzureArcMonitoringCost", and + "AzureArcPatchingCost". + :paramtype name: str or ~azure.mgmt.migrationassessment.models.ManagementCostComponentName + :keyword value: Cost of Management Component. + :paramtype value: float + """ + super().__init__(**kwargs) + self.name = name + self.value = value + + +class ManagementCostDetails(_serialization.Model): + """Management Cost Details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar management_cost: Management Cost. + :vartype management_cost: float + :ivar management_cost_components: Management Cost Components. + :vartype management_cost_components: + list[~azure.mgmt.migrationassessment.models.ManagementCostComponent] + """ + + _validation = { + "management_cost": {"readonly": True}, + "management_cost_components": {"readonly": True}, + } + + _attribute_map = { + "management_cost": {"key": "managementCost", "type": "float"}, + "management_cost_components": {"key": "managementCostComponents", "type": "[ManagementCostComponent]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.management_cost = None + self.management_cost_components = None + + +class ManagementSettings(_serialization.Model): + """Management settings. + + All required parameters must be populated in order to send to server. + + :ivar hyperv_virtualization_management_settings: HyperV Virtualization Management Settings. + Required. + :vartype hyperv_virtualization_management_settings: + ~azure.mgmt.migrationassessment.models.HypervVirtualizationManagementSettings + :ivar third_party_management_settings: Third Party Management Settings. Required. + :vartype third_party_management_settings: + ~azure.mgmt.migrationassessment.models.ThirdPartyManagementSettings + :ivar other_management_costs_settings: Other Management Costs Settings. Required. + :vartype other_management_costs_settings: + ~azure.mgmt.migrationassessment.models.OtherManagementCostsSettings + """ + + _validation = { + "hyperv_virtualization_management_settings": {"required": True}, + "third_party_management_settings": {"required": True}, + "other_management_costs_settings": {"required": True}, + } + + _attribute_map = { + "hyperv_virtualization_management_settings": { + "key": "hypervVirtualizationManagementSettings", + "type": "HypervVirtualizationManagementSettings", + }, + "third_party_management_settings": { + "key": "thirdPartyManagementSettings", + "type": "ThirdPartyManagementSettings", + }, + "other_management_costs_settings": { + "key": "otherManagementCostsSettings", + "type": "OtherManagementCostsSettings", + }, + } + + def __init__( + self, + *, + hyperv_virtualization_management_settings: "_models.HypervVirtualizationManagementSettings", + third_party_management_settings: "_models.ThirdPartyManagementSettings", + other_management_costs_settings: "_models.OtherManagementCostsSettings", + **kwargs: Any + ) -> None: + """ + :keyword hyperv_virtualization_management_settings: HyperV Virtualization Management Settings. + Required. + :paramtype hyperv_virtualization_management_settings: + ~azure.mgmt.migrationassessment.models.HypervVirtualizationManagementSettings + :keyword third_party_management_settings: Third Party Management Settings. Required. + :paramtype third_party_management_settings: + ~azure.mgmt.migrationassessment.models.ThirdPartyManagementSettings + :keyword other_management_costs_settings: Other Management Costs Settings. Required. + :paramtype other_management_costs_settings: + ~azure.mgmt.migrationassessment.models.OtherManagementCostsSettings + """ + super().__init__(**kwargs) + self.hyperv_virtualization_management_settings = hyperv_virtualization_management_settings + self.third_party_management_settings = third_party_management_settings + self.other_management_costs_settings = other_management_costs_settings + + +class MigrationGuidelineContext(_serialization.Model): + """Migration Guideline Context. + + :ivar context_key: Gets the reasoning context key. + :vartype context_key: str + :ivar context_value: Gets the reasoning context value. + :vartype context_value: str + """ + + _attribute_map = { + "context_key": {"key": "contextKey", "type": "str"}, + "context_value": {"key": "contextValue", "type": "str"}, + } + + def __init__( + self, *, context_key: Optional[str] = None, context_value: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword context_key: Gets the reasoning context key. + :paramtype context_key: str + :keyword context_value: Gets the reasoning context value. + :paramtype context_value: str + """ + super().__init__(**kwargs) + self.context_key = context_key + self.context_value = context_value + + +class MoreInfo(_serialization.Model): + """Data model of More information about check or rule. + + 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 title: Gets title. Required. + :vartype title: str + :ivar url: Gets url. Required. + :vartype url: str + """ + + _validation = { + "title": {"required": True, "readonly": True}, + "url": {"required": True, "readonly": True}, + } + + _attribute_map = { + "title": {"key": "title", "type": "str"}, + "url": {"key": "url", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.title = None + self.url = None + + +class NetworkAdapter(_serialization.Model): + """A network adapter discovered on a machine. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar mac_address: MAC Address of the network adapter. + :vartype mac_address: str + :ivar ip_addresses: List of IP Addresses on the network adapter. + :vartype ip_addresses: list[str] + :ivar display_name: User friendly name of the network adapter. + :vartype display_name: str + """ + + _validation = { + "mac_address": {"readonly": True}, + "ip_addresses": {"readonly": True}, + "display_name": {"readonly": True}, + } + + _attribute_map = { + "mac_address": {"key": "macAddress", "type": "str"}, + "ip_addresses": {"key": "ipAddresses", "type": "[str]"}, + "display_name": {"key": "displayName", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.mac_address = None + self.ip_addresses = None + self.display_name = None + + +class NetworkSettings(_serialization.Model): + """Network settings. + + All required parameters must be populated in order to send to server. + + :ivar hardware_software_cost_percentage: Network hardware and software cost percentage. + Required. + :vartype hardware_software_cost_percentage: float + :ivar maintenance_cost_percentage: Network maintenance cost percentage. Required. + :vartype maintenance_cost_percentage: float + """ + + _validation = { + "hardware_software_cost_percentage": {"required": True, "maximum": 100, "minimum": 0}, + "maintenance_cost_percentage": {"required": True, "maximum": 100, "minimum": 0}, + } + + _attribute_map = { + "hardware_software_cost_percentage": {"key": "hardwareSoftwareCostPercentage", "type": "float"}, + "maintenance_cost_percentage": {"key": "maintenanceCostPercentage", "type": "float"}, + } + + def __init__( + self, *, hardware_software_cost_percentage: float, maintenance_cost_percentage: float, **kwargs: Any + ) -> None: + """ + :keyword hardware_software_cost_percentage: Network hardware and software cost percentage. + Required. + :paramtype hardware_software_cost_percentage: float + :keyword maintenance_cost_percentage: Network maintenance cost percentage. Required. + :paramtype maintenance_cost_percentage: float + """ + super().__init__(**kwargs) + self.hardware_software_cost_percentage = hardware_software_cost_percentage + self.maintenance_cost_percentage = maintenance_cost_percentage + + +class OnPremiseSettings(_serialization.Model): + """On-premise settings. + + All required parameters must be populated in order to send to server. + + :ivar compute_settings: Compute settings. Required. + :vartype compute_settings: ~azure.mgmt.migrationassessment.models.ComputeSettings + :ivar storage_settings: Storage settings. Required. + :vartype storage_settings: ~azure.mgmt.migrationassessment.models.StorageSettings + :ivar network_settings: Network settings. Required. + :vartype network_settings: ~azure.mgmt.migrationassessment.models.NetworkSettings + :ivar facility_settings: Facility settings. Required. + :vartype facility_settings: ~azure.mgmt.migrationassessment.models.FacilitySettings + :ivar labor_settings: Labour settings. Required. + :vartype labor_settings: ~azure.mgmt.migrationassessment.models.LaborSettings + :ivar security_settings: Security settings. Required. + :vartype security_settings: ~azure.mgmt.migrationassessment.models.SecuritySettings + :ivar management_settings: Management settings. + :vartype management_settings: ~azure.mgmt.migrationassessment.models.ManagementSettings + """ + + _validation = { + "compute_settings": {"required": True}, + "storage_settings": {"required": True}, + "network_settings": {"required": True}, + "facility_settings": {"required": True}, + "labor_settings": {"required": True}, + "security_settings": {"required": True}, + } + + _attribute_map = { + "compute_settings": {"key": "computeSettings", "type": "ComputeSettings"}, + "storage_settings": {"key": "storageSettings", "type": "StorageSettings"}, + "network_settings": {"key": "networkSettings", "type": "NetworkSettings"}, + "facility_settings": {"key": "facilitySettings", "type": "FacilitySettings"}, + "labor_settings": {"key": "laborSettings", "type": "LaborSettings"}, + "security_settings": {"key": "securitySettings", "type": "SecuritySettings"}, + "management_settings": {"key": "managementSettings", "type": "ManagementSettings"}, + } + + def __init__( + self, + *, + compute_settings: "_models.ComputeSettings", + storage_settings: "_models.StorageSettings", + network_settings: "_models.NetworkSettings", + facility_settings: "_models.FacilitySettings", + labor_settings: "_models.LaborSettings", + security_settings: "_models.SecuritySettings", + management_settings: Optional["_models.ManagementSettings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword compute_settings: Compute settings. Required. + :paramtype compute_settings: ~azure.mgmt.migrationassessment.models.ComputeSettings + :keyword storage_settings: Storage settings. Required. + :paramtype storage_settings: ~azure.mgmt.migrationassessment.models.StorageSettings + :keyword network_settings: Network settings. Required. + :paramtype network_settings: ~azure.mgmt.migrationassessment.models.NetworkSettings + :keyword facility_settings: Facility settings. Required. + :paramtype facility_settings: ~azure.mgmt.migrationassessment.models.FacilitySettings + :keyword labor_settings: Labour settings. Required. + :paramtype labor_settings: ~azure.mgmt.migrationassessment.models.LaborSettings + :keyword security_settings: Security settings. Required. + :paramtype security_settings: ~azure.mgmt.migrationassessment.models.SecuritySettings + :keyword management_settings: Management settings. + :paramtype management_settings: ~azure.mgmt.migrationassessment.models.ManagementSettings + """ + super().__init__(**kwargs) + self.compute_settings = compute_settings + self.storage_settings = storage_settings + self.network_settings = network_settings + self.facility_settings = facility_settings + self.labor_settings = labor_settings + self.security_settings = security_settings + self.management_settings = management_settings + + +class OnPremisesIaasSummary(_serialization.Model): + """The on premises IAAS summary. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar servers: The number of servers. + :vartype servers: int + :ivar cores: The number of cores. + :vartype cores: int + :ivar memory_gb: Total memory in GB. + :vartype memory_gb: float + :ivar cpu_utilization: The CPU utilization. + :vartype cpu_utilization: float + :ivar memory_utilization: The memory utilization. + :vartype memory_utilization: float + :ivar storage_utilization: The storage utilization. + :vartype storage_utilization: float + :ivar on_premises_iaas_cost_details: The on premises PaaS cost. + :vartype on_premises_iaas_cost_details: ~azure.mgmt.migrationassessment.models.CostDetails + :ivar on_premises_iaas_cost_for_decommissioned: The on premises PaaS cost. + :vartype on_premises_iaas_cost_for_decommissioned: + ~azure.mgmt.migrationassessment.models.CostDetails + :ivar os_licensing_details: The OS licensing details. + :vartype os_licensing_details: + list[~azure.mgmt.migrationassessment.models.IaasOsLicensingDetails] + :ivar distribution_by_operating_system: The distribution by operating system. + :vartype distribution_by_operating_system: + list[~azure.mgmt.migrationassessment.models.DistributionByOperatingSystem] + :ivar on_premises_utilization_data: The SQL on premises utilization insights. + :vartype on_premises_utilization_data: ~azure.mgmt.migrationassessment.models.UtilizationData + :ivar distribution_by_virtualization: The distribution by virtualization. + :vartype distribution_by_virtualization: + list[~azure.mgmt.migrationassessment.models.DistributionByVirtualization] + :ivar iaas_os_support_status_distribution: Iaas OS Support Status Distribution. + :vartype iaas_os_support_status_distribution: + ~azure.mgmt.migrationassessment.models.SupportStatusDistribution + :ivar iaas_sql_support_status_distribution: Iaas Sql Support Status Distribution. + :vartype iaas_sql_support_status_distribution: + ~azure.mgmt.migrationassessment.models.SupportStatusDistribution + :ivar os_service_pack_insight: OS Service Pack Insight. + :vartype os_service_pack_insight: ~azure.mgmt.migrationassessment.models.ServicePackInsight + :ivar sql_service_pack_insight: Sql Service Pack Insight. + :vartype sql_service_pack_insight: ~azure.mgmt.migrationassessment.models.ServicePackInsight + :ivar distribution_by_operating_system_version: Distribution by Operating System Version. + :vartype distribution_by_operating_system_version: + list[~azure.mgmt.migrationassessment.models.DistributionByType] + :ivar distribution_by_sql_version: Distribution by Sql Version. + :vartype distribution_by_sql_version: + list[~azure.mgmt.migrationassessment.models.DistributionByType] + :ivar distribution_by_sql_edition: Distribution by Sql Edition. + :vartype distribution_by_sql_edition: + list[~azure.mgmt.migrationassessment.models.DistributionByType] + """ + + _validation = { + "servers": {"readonly": True}, + "cores": {"readonly": True}, + "memory_gb": {"readonly": True}, + "cpu_utilization": {"readonly": True}, + "memory_utilization": {"readonly": True}, + "storage_utilization": {"readonly": True}, + "on_premises_iaas_cost_details": {"readonly": True}, + "on_premises_iaas_cost_for_decommissioned": {"readonly": True}, + "os_licensing_details": {"readonly": True}, + "distribution_by_operating_system": {"readonly": True}, + "on_premises_utilization_data": {"readonly": True}, + "distribution_by_virtualization": {"readonly": True}, + "iaas_os_support_status_distribution": {"readonly": True}, + "iaas_sql_support_status_distribution": {"readonly": True}, + "os_service_pack_insight": {"readonly": True}, + "sql_service_pack_insight": {"readonly": True}, + "distribution_by_operating_system_version": {"readonly": True}, + "distribution_by_sql_version": {"readonly": True}, + "distribution_by_sql_edition": {"readonly": True}, + } + + _attribute_map = { + "servers": {"key": "servers", "type": "int"}, + "cores": {"key": "cores", "type": "int"}, + "memory_gb": {"key": "memoryGb", "type": "float"}, + "cpu_utilization": {"key": "cpuUtilization", "type": "float"}, + "memory_utilization": {"key": "memoryUtilization", "type": "float"}, + "storage_utilization": {"key": "storageUtilization", "type": "float"}, + "on_premises_iaas_cost_details": {"key": "onPremisesIaasCostDetails", "type": "CostDetails"}, + "on_premises_iaas_cost_for_decommissioned": { + "key": "onPremisesIaasCostForDecommissioned", + "type": "CostDetails", + }, + "os_licensing_details": {"key": "osLicensingDetails", "type": "[IaasOsLicensingDetails]"}, + "distribution_by_operating_system": { + "key": "distributionByOperatingSystem", + "type": "[DistributionByOperatingSystem]", + }, + "on_premises_utilization_data": {"key": "onPremisesUtilizationData", "type": "UtilizationData"}, + "distribution_by_virtualization": { + "key": "distributionByVirtualization", + "type": "[DistributionByVirtualization]", + }, + "iaas_os_support_status_distribution": { + "key": "iaasOsSupportStatusDistribution", + "type": "SupportStatusDistribution", + }, + "iaas_sql_support_status_distribution": { + "key": "iaasSqlSupportStatusDistribution", + "type": "SupportStatusDistribution", + }, + "os_service_pack_insight": {"key": "osServicePackInsight", "type": "ServicePackInsight"}, + "sql_service_pack_insight": {"key": "sqlServicePackInsight", "type": "ServicePackInsight"}, + "distribution_by_operating_system_version": { + "key": "distributionByOperatingSystemVersion", + "type": "[DistributionByType]", + }, + "distribution_by_sql_version": {"key": "distributionBySqlVersion", "type": "[DistributionByType]"}, + "distribution_by_sql_edition": {"key": "distributionBySqlEdition", "type": "[DistributionByType]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.servers = None + self.cores = None + self.memory_gb = None + self.cpu_utilization = None + self.memory_utilization = None + self.storage_utilization = None + self.on_premises_iaas_cost_details = None + self.on_premises_iaas_cost_for_decommissioned = None + self.os_licensing_details = None + self.distribution_by_operating_system = None + self.on_premises_utilization_data = None + self.distribution_by_virtualization = None + self.iaas_os_support_status_distribution = None + self.iaas_sql_support_status_distribution = None + self.os_service_pack_insight = None + self.sql_service_pack_insight = None + self.distribution_by_operating_system_version = None + self.distribution_by_sql_version = None + self.distribution_by_sql_edition = None + + +class OnPremisesPaasLicensingCost(_serialization.Model): + """The on premises paas licensing cost. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar version: The version. + :vartype version: str + :ivar total_cost: The total cost. + :vartype total_cost: float + :ivar decomission_server_cost: The decommissioned server cost. + :vartype decomission_server_cost: float + """ + + _validation = { + "version": {"readonly": True}, + "total_cost": {"readonly": True}, + "decomission_server_cost": {"readonly": True}, + } + + _attribute_map = { + "version": {"key": "version", "type": "str"}, + "total_cost": {"key": "totalCost", "type": "float"}, + "decomission_server_cost": {"key": "decomissionServerCost", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.version = None + self.total_cost = None + self.decomission_server_cost = None + + +class OnPremisesPaasSummary(_serialization.Model): + """Shows platform as a service (PaaS) summary. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar total_servers: Total servers. + :vartype total_servers: int + :ivar cpu_utilization: CPU utilization percentage. + :vartype cpu_utilization: float + :ivar memory_utilization: Memory utilization percentage. + :vartype memory_utilization: float + :ivar total_on_premises_paas_cost: The on premises PaaS cost. + :vartype total_on_premises_paas_cost: ~azure.mgmt.migrationassessment.models.CostDetails + :ivar on_premises_paas_cost_for_decommisioned: The on premises PaaS cost. + :vartype on_premises_paas_cost_for_decommisioned: + ~azure.mgmt.migrationassessment.models.CostDetails + :ivar on_premises_paas_licensing_cost: The on premises paas licensing cost. + :vartype on_premises_paas_licensing_cost: + ~azure.mgmt.migrationassessment.models.OnPremisesPaasLicensingCost + :ivar on_premises_sql_summary: The on premises SQL summary. + :vartype on_premises_sql_summary: ~azure.mgmt.migrationassessment.models.OnPremisesSqlSummary + :ivar on_premises_web_app_summary: The on premises web application summary. + :vartype on_premises_web_app_summary: + ~azure.mgmt.migrationassessment.models.OnPremisesWebAppSummary + :ivar os_support_status_distribution: OS Support Status Distribution. + :vartype os_support_status_distribution: + ~azure.mgmt.migrationassessment.models.SupportStatusDistribution + :ivar sql_support_status_distribution: Sql Support Status Distribution. + :vartype sql_support_status_distribution: + ~azure.mgmt.migrationassessment.models.SupportStatusDistribution + :ivar os_service_pack_insight: OS Service Pack Insight. + :vartype os_service_pack_insight: ~azure.mgmt.migrationassessment.models.ServicePackInsight + :ivar sql_service_pack_insight: Sql Service Pack Insight. + :vartype sql_service_pack_insight: ~azure.mgmt.migrationassessment.models.ServicePackInsight + """ + + _validation = { + "total_servers": {"readonly": True}, + "cpu_utilization": {"readonly": True}, + "memory_utilization": {"readonly": True}, + "total_on_premises_paas_cost": {"readonly": True}, + "on_premises_paas_cost_for_decommisioned": {"readonly": True}, + "on_premises_paas_licensing_cost": {"readonly": True}, + "on_premises_sql_summary": {"readonly": True}, + "on_premises_web_app_summary": {"readonly": True}, + "os_support_status_distribution": {"readonly": True}, + "sql_support_status_distribution": {"readonly": True}, + "os_service_pack_insight": {"readonly": True}, + "sql_service_pack_insight": {"readonly": True}, + } + + _attribute_map = { + "total_servers": {"key": "totalServers", "type": "int"}, + "cpu_utilization": {"key": "cpuUtilization", "type": "float"}, + "memory_utilization": {"key": "memoryUtilization", "type": "float"}, + "total_on_premises_paas_cost": {"key": "totalOnPremisesPaasCost", "type": "CostDetails"}, + "on_premises_paas_cost_for_decommisioned": {"key": "onPremisesPaasCostForDecommisioned", "type": "CostDetails"}, + "on_premises_paas_licensing_cost": { + "key": "onPremisesPaasLicensingCost", + "type": "OnPremisesPaasLicensingCost", + }, + "on_premises_sql_summary": {"key": "onPremisesSqlSummary", "type": "OnPremisesSqlSummary"}, + "on_premises_web_app_summary": {"key": "onPremisesWebAppSummary", "type": "OnPremisesWebAppSummary"}, + "os_support_status_distribution": {"key": "osSupportStatusDistribution", "type": "SupportStatusDistribution"}, + "sql_support_status_distribution": {"key": "sqlSupportStatusDistribution", "type": "SupportStatusDistribution"}, + "os_service_pack_insight": {"key": "osServicePackInsight", "type": "ServicePackInsight"}, + "sql_service_pack_insight": {"key": "sqlServicePackInsight", "type": "ServicePackInsight"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.total_servers = None + self.cpu_utilization = None + self.memory_utilization = None + self.total_on_premises_paas_cost = None + self.on_premises_paas_cost_for_decommisioned = None + self.on_premises_paas_licensing_cost = None + self.on_premises_sql_summary = None + self.on_premises_web_app_summary = None + self.os_support_status_distribution = None + self.sql_support_status_distribution = None + self.os_service_pack_insight = None + self.sql_service_pack_insight = None + + +class OnPremisesSqlSummary(_serialization.Model): + """The on premises SQL summary. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar sql_instances: The number of SQL instances. + :vartype sql_instances: int + :ivar sql_databases: The number of SQL databases. + :vartype sql_databases: int + :ivar distribution_by_sql_version: Distribution by SQL version. + :vartype distribution_by_sql_version: + list[~azure.mgmt.migrationassessment.models.SqlVersionDetails] + :ivar sql_on_premises_utilization_data: The SQL on premises utilization insights. + :vartype sql_on_premises_utilization_data: + ~azure.mgmt.migrationassessment.models.UtilizationData + :ivar distribution_by_sql_edition: Distribution by Sql Edition. + :vartype distribution_by_sql_edition: + list[~azure.mgmt.migrationassessment.models.DistributionByType] + """ + + _validation = { + "sql_instances": {"readonly": True}, + "sql_databases": {"readonly": True}, + "distribution_by_sql_version": {"readonly": True}, + "sql_on_premises_utilization_data": {"readonly": True}, + "distribution_by_sql_edition": {"readonly": True}, + } + + _attribute_map = { + "sql_instances": {"key": "sqlInstances", "type": "int"}, + "sql_databases": {"key": "sqlDatabases", "type": "int"}, + "distribution_by_sql_version": {"key": "distributionBySqlVersion", "type": "[SqlVersionDetails]"}, + "sql_on_premises_utilization_data": {"key": "sqlOnPremisesUtilizationData", "type": "UtilizationData"}, + "distribution_by_sql_edition": {"key": "distributionBySqlEdition", "type": "[DistributionByType]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.sql_instances = None + self.sql_databases = None + self.distribution_by_sql_version = None + self.sql_on_premises_utilization_data = None + self.distribution_by_sql_edition = None + + +class OnPremisesWebAppSummary(_serialization.Model): + """The on premises web application summary. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar number_of_web_servers: The number of web servers. + :vartype number_of_web_servers: int + :ivar number_of_web_applications: The number of web applications. + :vartype number_of_web_applications: int + :ivar number_of_web_apps_per_type: The number of web applications per web application type. + :vartype number_of_web_apps_per_type: dict[str, int] + """ + + _validation = { + "number_of_web_servers": {"readonly": True}, + "number_of_web_applications": {"readonly": True}, + "number_of_web_apps_per_type": {"readonly": True}, + } + + _attribute_map = { + "number_of_web_servers": {"key": "numberOfWebServers", "type": "int"}, + "number_of_web_applications": {"key": "numberOfWebApplications", "type": "int"}, + "number_of_web_apps_per_type": {"key": "numberOfWebAppsPerType", "type": "{int}"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.number_of_web_servers = None + self.number_of_web_applications = None + self.number_of_web_apps_per_type = None + + +class Operation(_serialization.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for ARM/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.migrationassessment.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", + and "user,system". + :vartype origin: str or ~azure.mgmt.migrationassessment.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. "Internal" + :vartype action_type: str or ~azure.mgmt.migrationassessment.models.ActionType + """ + + _validation = { + "name": {"readonly": True}, + "is_data_action": {"readonly": True}, + "origin": {"readonly": True}, + "action_type": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, + "display": {"key": "display", "type": "OperationDisplay"}, + "origin": {"key": "origin", "type": "str"}, + "action_type": {"key": "actionType", "type": "str"}, + } + + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.migrationassessment.models.OperationDisplay + """ + super().__init__(**kwargs) + self.name = None + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None + + +class OperationDisplay(_serialization.Model): + """Localized display information for this particular operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str + """ + + _validation = { + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationListResult(_serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link + to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.migrationassessment.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class OtherManagementCostsSettings(_serialization.Model): + """Other Management Costs Settings. + + All required parameters must be populated in order to send to server. + + :ivar monitoring_cost_per_server_per_year: Monitoring Cost Per Server Per Year. Required. + :vartype monitoring_cost_per_server_per_year: float + :ivar patching_cost_per_server_per_year: Patching Cost Per Server Per Year. Required. + :vartype patching_cost_per_server_per_year: float + :ivar data_protection_cost_per_server_per_year: Data Protection Cost Per Server Per Year. + Required. + :vartype data_protection_cost_per_server_per_year: float + """ + + _validation = { + "monitoring_cost_per_server_per_year": {"required": True}, + "patching_cost_per_server_per_year": {"required": True}, + "data_protection_cost_per_server_per_year": {"required": True}, + } + + _attribute_map = { + "monitoring_cost_per_server_per_year": {"key": "monitoringCostPerServerPerYear", "type": "float"}, + "patching_cost_per_server_per_year": {"key": "patchingCostPerServerPerYear", "type": "float"}, + "data_protection_cost_per_server_per_year": {"key": "dataProtectionCostPerServerPerYear", "type": "float"}, + } + + def __init__( + self, + *, + monitoring_cost_per_server_per_year: float, + patching_cost_per_server_per_year: float, + data_protection_cost_per_server_per_year: float, + **kwargs: Any + ) -> None: + """ + :keyword monitoring_cost_per_server_per_year: Monitoring Cost Per Server Per Year. Required. + :paramtype monitoring_cost_per_server_per_year: float + :keyword patching_cost_per_server_per_year: Patching Cost Per Server Per Year. Required. + :paramtype patching_cost_per_server_per_year: float + :keyword data_protection_cost_per_server_per_year: Data Protection Cost Per Server Per Year. + Required. + :paramtype data_protection_cost_per_server_per_year: float + """ + super().__init__(**kwargs) + self.monitoring_cost_per_server_per_year = monitoring_cost_per_server_per_year + self.patching_cost_per_server_per_year = patching_cost_per_server_per_year + self.data_protection_cost_per_server_per_year = data_protection_cost_per_server_per_year + + +class OverviewSummary(ProxyResource): + """Overview summary REST 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.OverviewSummaryProperties + """ + + _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": "OverviewSummaryProperties"}, + } + + def __init__(self, *, properties: Optional["_models.OverviewSummaryProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.OverviewSummaryProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class OverviewSummaryListResult(_serialization.Model): + """The response of a OverviewSummary list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The OverviewSummary items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.OverviewSummary] + :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": "[OverviewSummary]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.OverviewSummary"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The OverviewSummary items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.OverviewSummary] + :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 OverviewSummaryProperties(_serialization.Model): + """Overview summary properties class. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar total_azure_cost: The total Azure cost.. + :vartype total_azure_cost: float + :ivar total_azure_iaas_cost: The total Azure IaaS cost. + :vartype total_azure_iaas_cost: float + :ivar total_azure_paas_cost: The total Azure PaaS cost. + :vartype total_azure_paas_cost: float + :ivar total_azure_avs_cost: The total Avs cost. + :vartype total_azure_avs_cost: float + :ivar windows_ahub_savings: The windows ahub saving. + :vartype windows_ahub_savings: float + :ivar linux_ahub_savings: The linux ahub saving. + :vartype linux_ahub_savings: float + :ivar sql_ahub_savings: The sql ahub saving. + :vartype sql_ahub_savings: float + :ivar total_on_premises_cost: The total on premises cost. + :vartype total_on_premises_cost: float + :ivar esu_savings_for4_years: ESU Savings 4 Years. + :vartype esu_savings_for4_years: float + :ivar management_cost_savings: The management cost saving. + :vartype management_cost_savings: float + :ivar security_cost_savings: The security cost saving. + :vartype security_cost_savings: float + :ivar year_on_year_estimates: Shows the year-on-year cost overall. + :vartype year_on_year_estimates: ~azure.mgmt.migrationassessment.models.YearOnYearEstimates + :ivar servers_discovered: Shows the discovered servers by virtualization platform. + :vartype servers_discovered: ~azure.mgmt.migrationassessment.models.ServersDiscovered + :ivar utilization_data: The SQL on premises utilization insights. + :vartype utilization_data: ~azure.mgmt.migrationassessment.models.UtilizationData + :ivar iaas_os_distribution: Shows the infrastructure as a service machine OS distribution. + :vartype iaas_os_distribution: ~azure.mgmt.migrationassessment.models.IaasOsDistribution + :ivar os_support_status_distribution: OS Support Status Distribution. + :vartype os_support_status_distribution: + ~azure.mgmt.migrationassessment.models.SupportStatusDistribution + :ivar sql_support_status_distribution: Sql Support Status Distribution. + :vartype sql_support_status_distribution: + ~azure.mgmt.migrationassessment.models.SupportStatusDistribution + :ivar paas_distribution: Shows the distribution of platforms. + :vartype paas_distribution: ~azure.mgmt.migrationassessment.models.PaasDistribution + :ivar azure_arc_enabled_on_premises_cost: The total Azure arc enabled on-premises cost assuming + all on-premises infra is arc enabled. + :vartype azure_arc_enabled_on_premises_cost: float + :ivar future_cost_including_azure_arc: The final cost including azure and azure arc enabled + on-premises considering the remaining on-prem infra is arc enabled. + :vartype future_cost_including_azure_arc: float + :ivar future_esu_savings_for4_years_including_azure_arc: ESU Savings in 4 Years considering the + remaining on-prem infra each year is arc enabled. + :vartype future_esu_savings_for4_years_including_azure_arc: float + :ivar future_management_cost_savings_including_azure_arc: The management cost saving + considering the remaining on-prem infra is arc enabled. + :vartype future_management_cost_savings_including_azure_arc: float + :ivar future_security_cost_savings_including_azure_arc: The security cost saving considering + the remaining on-prem infra is arc enabled. + :vartype future_security_cost_savings_including_azure_arc: float + :ivar azure_arc_services_cost: The total cost of services offered by azure arc. + :vartype azure_arc_services_cost: float + :ivar future_azure_iaas_cost: The Iaas component of the future azure cost based on the final + migration percentage. + :vartype future_azure_iaas_cost: float + :ivar future_azure_paas_cost: The Paas component of the future azure cost based on the final + migration percentage. + :vartype future_azure_paas_cost: float + :ivar future_azure_arc_enabled_on_premises_cost: The future azure arc cost based on the final + migration percentage. + :vartype future_azure_arc_enabled_on_premises_cost: float + :ivar future_azure_arc_services_cost: The total cost of services offered by azure arc based on + the final migration percentage. + :vartype future_azure_arc_services_cost: float + """ + + _validation = { + "total_azure_cost": {"readonly": True}, + "total_azure_iaas_cost": {"readonly": True}, + "total_azure_paas_cost": {"readonly": True}, + "total_azure_avs_cost": {"readonly": True}, + "windows_ahub_savings": {"readonly": True}, + "linux_ahub_savings": {"readonly": True}, + "sql_ahub_savings": {"readonly": True}, + "total_on_premises_cost": {"readonly": True}, + "esu_savings_for4_years": {"readonly": True}, + "management_cost_savings": {"readonly": True}, + "security_cost_savings": {"readonly": True}, + "year_on_year_estimates": {"readonly": True}, + "servers_discovered": {"readonly": True}, + "utilization_data": {"readonly": True}, + "iaas_os_distribution": {"readonly": True}, + "os_support_status_distribution": {"readonly": True}, + "sql_support_status_distribution": {"readonly": True}, + "paas_distribution": {"readonly": True}, + "azure_arc_enabled_on_premises_cost": {"readonly": True}, + "future_cost_including_azure_arc": {"readonly": True}, + "future_esu_savings_for4_years_including_azure_arc": {"readonly": True}, + "future_management_cost_savings_including_azure_arc": {"readonly": True}, + "future_security_cost_savings_including_azure_arc": {"readonly": True}, + "azure_arc_services_cost": {"readonly": True}, + "future_azure_iaas_cost": {"readonly": True}, + "future_azure_paas_cost": {"readonly": True}, + "future_azure_arc_enabled_on_premises_cost": {"readonly": True}, + "future_azure_arc_services_cost": {"readonly": True}, + } + + _attribute_map = { + "total_azure_cost": {"key": "totalAzureCost", "type": "float"}, + "total_azure_iaas_cost": {"key": "totalAzureIaasCost", "type": "float"}, + "total_azure_paas_cost": {"key": "totalAzurePaasCost", "type": "float"}, + "total_azure_avs_cost": {"key": "totalAzureAvsCost", "type": "float"}, + "windows_ahub_savings": {"key": "windowsAhubSavings", "type": "float"}, + "linux_ahub_savings": {"key": "linuxAhubSavings", "type": "float"}, + "sql_ahub_savings": {"key": "sqlAhubSavings", "type": "float"}, + "total_on_premises_cost": {"key": "totalOnPremisesCost", "type": "float"}, + "esu_savings_for4_years": {"key": "esuSavingsFor4years", "type": "float"}, + "management_cost_savings": {"key": "managementCostSavings", "type": "float"}, + "security_cost_savings": {"key": "securityCostSavings", "type": "float"}, + "year_on_year_estimates": {"key": "yearOnYearEstimates", "type": "YearOnYearEstimates"}, + "servers_discovered": {"key": "serversDiscovered", "type": "ServersDiscovered"}, + "utilization_data": {"key": "utilizationData", "type": "UtilizationData"}, + "iaas_os_distribution": {"key": "iaasOsDistribution", "type": "IaasOsDistribution"}, + "os_support_status_distribution": {"key": "osSupportStatusDistribution", "type": "SupportStatusDistribution"}, + "sql_support_status_distribution": {"key": "sqlSupportStatusDistribution", "type": "SupportStatusDistribution"}, + "paas_distribution": {"key": "paasDistribution", "type": "PaasDistribution"}, + "azure_arc_enabled_on_premises_cost": {"key": "azureArcEnabledOnPremisesCost", "type": "float"}, + "future_cost_including_azure_arc": {"key": "futureCostIncludingAzureArc", "type": "float"}, + "future_esu_savings_for4_years_including_azure_arc": { + "key": "futureEsuSavingsFor4YearsIncludingAzureArc", + "type": "float", + }, + "future_management_cost_savings_including_azure_arc": { + "key": "futureManagementCostSavingsIncludingAzureArc", + "type": "float", + }, + "future_security_cost_savings_including_azure_arc": { + "key": "futureSecurityCostSavingsIncludingAzureArc", + "type": "float", + }, + "azure_arc_services_cost": {"key": "azureArcServicesCost", "type": "float"}, + "future_azure_iaas_cost": {"key": "futureAzureIaasCost", "type": "float"}, + "future_azure_paas_cost": {"key": "futureAzurePaasCost", "type": "float"}, + "future_azure_arc_enabled_on_premises_cost": {"key": "futureAzureArcEnabledOnPremisesCost", "type": "float"}, + "future_azure_arc_services_cost": {"key": "futureAzureArcServicesCost", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: # pylint: disable=too-many-locals + """ """ + super().__init__(**kwargs) + self.total_azure_cost = None + self.total_azure_iaas_cost = None + self.total_azure_paas_cost = None + self.total_azure_avs_cost = None + self.windows_ahub_savings = None + self.linux_ahub_savings = None + self.sql_ahub_savings = None + self.total_on_premises_cost = None + self.esu_savings_for4_years = None + self.management_cost_savings = None + self.security_cost_savings = None + self.year_on_year_estimates = None + self.servers_discovered = None + self.utilization_data = None + self.iaas_os_distribution = None + self.os_support_status_distribution = None + self.sql_support_status_distribution = None + self.paas_distribution = None + self.azure_arc_enabled_on_premises_cost = None + self.future_cost_including_azure_arc = None + self.future_esu_savings_for4_years_including_azure_arc = None + self.future_management_cost_savings_including_azure_arc = None + self.future_security_cost_savings_including_azure_arc = None + self.azure_arc_services_cost = None + self.future_azure_iaas_cost = None + self.future_azure_paas_cost = None + self.future_azure_arc_enabled_on_premises_cost = None + self.future_azure_arc_services_cost = None + + +class PaasDistribution(_serialization.Model): + """Shows the distribution of platforms. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar sql_servers: Number of SQL Server machines. + :vartype sql_servers: int + :ivar iis_web_servers: Number of IIS Web servers. + :vartype iis_web_servers: int + :ivar web_app_distribution: Distribution of webapps for each target type. + :vartype web_app_distribution: dict[str, int] + """ + + _validation = { + "sql_servers": {"readonly": True}, + "iis_web_servers": {"readonly": True}, + "web_app_distribution": {"readonly": True}, + } + + _attribute_map = { + "sql_servers": {"key": "sqlServers", "type": "int"}, + "iis_web_servers": {"key": "iisWebServers", "type": "int"}, + "web_app_distribution": {"key": "webAppDistribution", "type": "{int}"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.sql_servers = None + self.iis_web_servers = None + self.web_app_distribution = None + + +class PaasSummary(ProxyResource): + """Paas summary REST 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.PaasSummaryProperties + """ + + _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": "PaasSummaryProperties"}, + } + + def __init__(self, *, properties: Optional["_models.PaasSummaryProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.PaasSummaryProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class PaasSummaryListResult(_serialization.Model): + """The response of a PaasSummary list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The PaasSummary items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.PaasSummary] + :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": "[PaasSummary]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.PaasSummary"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The PaasSummary items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.PaasSummary] + :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 PaasSummaryProperties(_serialization.Model): + """Paas summary properties class. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar azure: Shows the PaaS Azure summary. + :vartype azure: ~azure.mgmt.migrationassessment.models.AzurePaasSummary + :ivar on_premises: Shows platform as a service (PaaS) summary. + :vartype on_premises: ~azure.mgmt.migrationassessment.models.OnPremisesPaasSummary + """ + + _validation = { + "azure": {"readonly": True}, + "on_premises": {"readonly": True}, + } + + _attribute_map = { + "azure": {"key": "azure", "type": "AzurePaasSummary"}, + "on_premises": {"key": "onPremises", "type": "OnPremisesPaasSummary"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.azure = None + self.on_premises = None + + +class PerfDataSettings(_serialization.Model): + """Data model of Performance Data Settings. + + All required parameters must be populated in order to send to server. + + :ivar time_range: Gets perf data time range. Required. Known values are: "Day", "Week", + "Month", and "Custom". + :vartype time_range: str or ~azure.mgmt.migrationassessment.models.TimeRange + :ivar perf_data_start_time: Gets or sets perf data start time. + :vartype perf_data_start_time: ~datetime.datetime + :ivar perf_data_end_time: Gets or sets perf data end time. + :vartype perf_data_end_time: ~datetime.datetime + :ivar percentile: Gets percentile utilization for performance data. Required. Known values are: + "Percentile50", "Percentile90", "Percentile95", and "Percentile99". + :vartype percentile: str or ~azure.mgmt.migrationassessment.models.Percentile + """ + + _validation = { + "time_range": {"required": True}, + "percentile": {"required": True}, + } + + _attribute_map = { + "time_range": {"key": "timeRange", "type": "str"}, + "perf_data_start_time": {"key": "perfDataStartTime", "type": "iso-8601"}, + "perf_data_end_time": {"key": "perfDataEndTime", "type": "iso-8601"}, + "percentile": {"key": "percentile", "type": "str"}, + } + + def __init__( + self, + *, + time_range: Union[str, "_models.TimeRange"], + percentile: Union[str, "_models.Percentile"], + perf_data_start_time: Optional[datetime.datetime] = None, + perf_data_end_time: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword time_range: Gets perf data time range. Required. Known values are: "Day", "Week", + "Month", and "Custom". + :paramtype time_range: str or ~azure.mgmt.migrationassessment.models.TimeRange + :keyword perf_data_start_time: Gets or sets perf data start time. + :paramtype perf_data_start_time: ~datetime.datetime + :keyword perf_data_end_time: Gets or sets perf data end time. + :paramtype perf_data_end_time: ~datetime.datetime + :keyword percentile: Gets percentile utilization for performance data. Required. Known values + are: "Percentile50", "Percentile90", "Percentile95", and "Percentile99". + :paramtype percentile: str or ~azure.mgmt.migrationassessment.models.Percentile + """ + super().__init__(**kwargs) + self.time_range = time_range + self.perf_data_start_time = perf_data_start_time + self.perf_data_end_time = perf_data_end_time + self.percentile = percentile + + +class PrivateEndpoint(_serialization.Model): + """The private endpoint resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ARM identifier for private endpoint. + :vartype id: str + """ + + _validation = { + "id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(ProxyResource): + """Private endpoint connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.PrivateEndpointConnectionProperties + """ + + _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": "PrivateEndpointConnectionProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: + ~azure.mgmt.migrationassessment.models.PrivateEndpointConnectionProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class PrivateEndpointConnectionListResult(_serialization.Model): + """The response of a PrivateEndpointConnection list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The PrivateEndpointConnection items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.PrivateEndpointConnection] + :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": "[PrivateEndpointConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.PrivateEndpointConnection"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The PrivateEndpointConnection items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.PrivateEndpointConnection] + :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 PrivateEndpointConnectionProperties(_serialization.Model): + """Properties of the private endpoint connection. + + 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 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.migrationassessment.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. Required. + :vartype private_link_service_connection_state: + ~azure.mgmt.migrationassessment.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.migrationassessment.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + "group_ids": {"readonly": True}, + "private_link_service_connection_state": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _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.migrationassessment.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.migrationassessment.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 PrivateLinkResource(ProxyResource): + """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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.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: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.PrivateLinkResourceProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class PrivateLinkResourceListResult(_serialization.Model): + """The response of a PrivateLinkResource list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The PrivateLinkResource items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.PrivateLinkResource] + :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": "[PrivateLinkResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.PrivateLinkResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The PrivateLinkResource items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.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 = 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): + """A collection of information about the state of the connection between service consumer and + provider. + + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Known values are: "Pending", "Approved", and "Rejected". + :vartype status: str or + ~azure.mgmt.migrationassessment.models.PrivateEndpointServiceConnectionStatus + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :vartype actions_required: str + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "actions_required": {"key": "actionsRequired", "type": "str"}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Known values are: "Pending", "Approved", and "Rejected". + :paramtype status: str or + ~azure.mgmt.migrationassessment.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype actions_required: str + """ + super().__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + +class ProcessorInfo(_serialization.Model): + """Represents a information details of a processor. + + :ivar name: Gets or sets the name model of a processor. + :vartype name: str + :ivar number_of_sockets: Gets or sets the number of sockets. + :vartype number_of_sockets: int + :ivar number_of_cores_per_socket: Gets or sets the number of cores in a socket. + :vartype number_of_cores_per_socket: int + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "number_of_sockets": {"key": "numberOfSockets", "type": "int"}, + "number_of_cores_per_socket": {"key": "numberOfCoresPerSocket", "type": "int"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + number_of_sockets: Optional[int] = None, + number_of_cores_per_socket: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Gets or sets the name model of a processor. + :paramtype name: str + :keyword number_of_sockets: Gets or sets the number of sockets. + :paramtype number_of_sockets: int + :keyword number_of_cores_per_socket: Gets or sets the number of cores in a socket. + :paramtype number_of_cores_per_socket: int + """ + super().__init__(**kwargs) + self.name = name + self.number_of_sockets = number_of_sockets + self.number_of_cores_per_socket = number_of_cores_per_socket + + +class ProductSupportStatus(_serialization.Model): + """Class to represent the Product Support Status. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar current_version: Gets or sets current version of ServicePack. + :vartype current_version: str + :ivar service_pack_status: Gets or sets ServicePack of the product. + :vartype service_pack_status: str + :ivar esu_status: Gets or sets the Extended Security Update ESU status. + :vartype esu_status: str + :ivar support_status: Gets or sets the support status of the product. + :vartype support_status: str + :ivar eta: Gets or sets the ETA. + :vartype eta: int + :ivar current_esu_year: Gets or sets the current ESU support year. + :vartype current_esu_year: str + :ivar mainstream_end_date: Gets or sets the main stream end date of the product. + :vartype mainstream_end_date: ~datetime.datetime + :ivar extended_support_end_date: Gets or sets the extended support end date of the product. + :vartype extended_support_end_date: ~datetime.datetime + :ivar extended_security_update_year1_end_date: Gets or sets the extended security update year 1 + end date of the product. + :vartype extended_security_update_year1_end_date: ~datetime.datetime + :ivar extended_security_update_year2_end_date: Gets or sets the extended security update year 2 + end date of the product. + :vartype extended_security_update_year2_end_date: ~datetime.datetime + :ivar extended_security_update_year3_end_date: Gets or sets the extended security update year 3 + end date of the product. + :vartype extended_security_update_year3_end_date: ~datetime.datetime + """ + + _validation = { + "current_version": {"readonly": True}, + "service_pack_status": {"readonly": True}, + "esu_status": {"readonly": True}, + "support_status": {"readonly": True}, + "eta": {"readonly": True}, + "current_esu_year": {"readonly": True}, + "mainstream_end_date": {"readonly": True}, + "extended_support_end_date": {"readonly": True}, + "extended_security_update_year1_end_date": {"readonly": True}, + "extended_security_update_year2_end_date": {"readonly": True}, + "extended_security_update_year3_end_date": {"readonly": True}, + } + + _attribute_map = { + "current_version": {"key": "currentVersion", "type": "str"}, + "service_pack_status": {"key": "servicePackStatus", "type": "str"}, + "esu_status": {"key": "esuStatus", "type": "str"}, + "support_status": {"key": "supportStatus", "type": "str"}, + "eta": {"key": "eta", "type": "int"}, + "current_esu_year": {"key": "currentEsuYear", "type": "str"}, + "mainstream_end_date": {"key": "mainstreamEndDate", "type": "iso-8601"}, + "extended_support_end_date": {"key": "extendedSupportEndDate", "type": "iso-8601"}, + "extended_security_update_year1_end_date": {"key": "extendedSecurityUpdateYear1EndDate", "type": "iso-8601"}, + "extended_security_update_year2_end_date": {"key": "extendedSecurityUpdateYear2EndDate", "type": "iso-8601"}, + "extended_security_update_year3_end_date": {"key": "extendedSecurityUpdateYear3EndDate", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.current_version = None + self.service_pack_status = None + self.esu_status = None + self.support_status = None + self.eta = None + self.current_esu_year = None + self.mainstream_end_date = None + self.extended_support_end_date = None + self.extended_security_update_year1_end_date = None + self.extended_security_update_year2_end_date = None + self.extended_security_update_year3_end_date = None + + +class ProjectProperties(AzureResourceProperties): + """Properties of a project. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningState + :ivar created_timestamp: Time when this project was created. Date-Time represented in ISO-8601 + format. + :vartype created_timestamp: ~datetime.datetime + :ivar updated_timestamp: Time when this project was last updated. Date-Time represented in + ISO-8601 + format. + :vartype updated_timestamp: ~datetime.datetime + :ivar service_endpoint: Endpoint at which the collector agent can call agent REST API. + :vartype service_endpoint: str + :ivar assessment_solution_id: Assessment solution ARM id tracked by + Microsoft.Migrate/migrateProjects. + :vartype assessment_solution_id: str + :ivar project_status: Assessment project status. Known values are: "Active" and "Inactive". + :vartype project_status: str or ~azure.mgmt.migrationassessment.models.ProjectStatus + :ivar customer_workspace_id: The ARM id of service map workspace created by customer. + :vartype customer_workspace_id: str + :ivar customer_workspace_location: Location of service map workspace created by customer. + :vartype customer_workspace_location: str + :ivar public_network_access: This value can be set to 'enabled' to avoid breaking changes on + existing + customer resources and templates. If set to 'disabled', traffic over public + interface is not allowed, and private endpoint connections would be the + exclusive access method. + :vartype public_network_access: str + :ivar private_endpoint_connections: The list of private endpoint connections to the project. + :vartype private_endpoint_connections: + list[~azure.mgmt.migrationassessment.models.PrivateEndpointConnection] + :ivar customer_storage_account_arm_id: The ARM id of the storage account used for interactions + when public access is + disabled. + :vartype customer_storage_account_arm_id: str + """ + + _validation = { + "created_timestamp": {"readonly": True}, + "updated_timestamp": {"readonly": True}, + "service_endpoint": {"readonly": True}, + "private_endpoint_connections": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "created_timestamp": {"key": "createdTimestamp", "type": "iso-8601"}, + "updated_timestamp": {"key": "updatedTimestamp", "type": "iso-8601"}, + "service_endpoint": {"key": "serviceEndpoint", "type": "str"}, + "assessment_solution_id": {"key": "assessmentSolutionId", "type": "str"}, + "project_status": {"key": "projectStatus", "type": "str"}, + "customer_workspace_id": {"key": "customerWorkspaceId", "type": "str"}, + "customer_workspace_location": {"key": "customerWorkspaceLocation", "type": "str"}, + "public_network_access": {"key": "publicNetworkAccess", "type": "str"}, + "private_endpoint_connections": {"key": "privateEndpointConnections", "type": "[PrivateEndpointConnection]"}, + "customer_storage_account_arm_id": {"key": "customerStorageAccountArmId", "type": "str"}, + } + + def __init__( + self, + *, + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, + assessment_solution_id: Optional[str] = None, + project_status: Optional[Union[str, "_models.ProjectStatus"]] = None, + customer_workspace_id: Optional[str] = None, + customer_workspace_location: Optional[str] = None, + public_network_access: Optional[str] = None, + customer_storage_account_arm_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :paramtype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningState + :keyword assessment_solution_id: Assessment solution ARM id tracked by + Microsoft.Migrate/migrateProjects. + :paramtype assessment_solution_id: str + :keyword project_status: Assessment project status. Known values are: "Active" and "Inactive". + :paramtype project_status: str or ~azure.mgmt.migrationassessment.models.ProjectStatus + :keyword customer_workspace_id: The ARM id of service map workspace created by customer. + :paramtype customer_workspace_id: str + :keyword customer_workspace_location: Location of service map workspace created by customer. + :paramtype customer_workspace_location: str + :keyword public_network_access: This value can be set to 'enabled' to avoid breaking changes on + existing + customer resources and templates. If set to 'disabled', traffic over public + interface is not allowed, and private endpoint connections would be the + exclusive access method. + :paramtype public_network_access: str + :keyword customer_storage_account_arm_id: The ARM id of the storage account used for + interactions when public access is + disabled. + :paramtype customer_storage_account_arm_id: str + """ + super().__init__(provisioning_state=provisioning_state, **kwargs) + self.created_timestamp = None + self.updated_timestamp = None + self.service_endpoint = None + self.assessment_solution_id = assessment_solution_id + self.project_status = project_status + self.customer_workspace_id = customer_workspace_id + self.customer_workspace_location = customer_workspace_location + self.public_network_access = public_network_access + self.private_endpoint_connections = None + self.customer_storage_account_arm_id = customer_storage_account_arm_id + + +class RecommendationResult(_serialization.Model): + """Data model of Recommendation Result. + + 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 request: Gets cores and memory request. Required. + :vartype request: ~azure.mgmt.migrationassessment.models.ComputeResource + :ivar limit: Gets cores and memory limit. Required. + :vartype limit: ~azure.mgmt.migrationassessment.models.ComputeResource + :ivar os_type: Gets os type. Required. Known values are: "Linux" and "Windows". + :vartype os_type: str or ~azure.mgmt.migrationassessment.models.OSType + :ivar cluster_name: Gets cluster name. Required. + :vartype cluster_name: str + :ivar node_pool_id: Gets node pool id. Required. + :vartype node_pool_id: str + :ivar node_pool_name: Gets node pool name. Required. + :vartype node_pool_name: str + :ivar node_pool_arm_sku_name: Gets node pool arm sku name. Required. + :vartype node_pool_arm_sku_name: str + :ivar approx_monthly_cost: Gets approximate monthly cost. Required. + :vartype approx_monthly_cost: float + """ + + _validation = { + "request": {"required": True, "readonly": True}, + "limit": {"required": True, "readonly": True}, + "os_type": {"required": True, "readonly": True}, + "cluster_name": {"required": True, "readonly": True}, + "node_pool_id": {"required": True, "readonly": True}, + "node_pool_name": {"required": True, "readonly": True}, + "node_pool_arm_sku_name": {"required": True, "readonly": True}, + "approx_monthly_cost": {"required": True, "readonly": True}, + } + + _attribute_map = { + "request": {"key": "request", "type": "ComputeResource"}, + "limit": {"key": "limit", "type": "ComputeResource"}, + "os_type": {"key": "osType", "type": "str"}, + "cluster_name": {"key": "clusterName", "type": "str"}, + "node_pool_id": {"key": "nodePoolId", "type": "str"}, + "node_pool_name": {"key": "nodePoolName", "type": "str"}, + "node_pool_arm_sku_name": {"key": "nodePoolArmSkuName", "type": "str"}, + "approx_monthly_cost": {"key": "approxMonthlyCost", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.request = None + self.limit = None + self.os_type = None + self.cluster_name = None + self.node_pool_id = None + self.node_pool_name = None + self.node_pool_arm_sku_name = None + self.approx_monthly_cost = None + + +class RecommendedAvsNodeTypeSummary(_serialization.Model): + """Azure Avs Node summary. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar avs_node_type: AVS node type. + :vartype avs_node_type: str + :ivar number_of_nodes: Number of nodes. + :vartype number_of_nodes: int + :ivar failures_to_tolerate_and_raid_level: Failures to tolerate and RAID level for the Node. + Known values are: "Unknown", "Ftt1Raid1", "Ftt1Raid5", "Ftt2Raid1", "Ftt2Raid6", and + "Ftt3Raid1". + :vartype failures_to_tolerate_and_raid_level: str or + ~azure.mgmt.migrationassessment.models.FttAndRaidLevel + """ + + _validation = { + "avs_node_type": {"readonly": True}, + "number_of_nodes": {"readonly": True}, + "failures_to_tolerate_and_raid_level": {"readonly": True}, + } + + _attribute_map = { + "avs_node_type": {"key": "avsNodeType", "type": "str"}, + "number_of_nodes": {"key": "numberOfNodes", "type": "int"}, + "failures_to_tolerate_and_raid_level": {"key": "failuresToTolerateAndRaidLevel", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.avs_node_type = None + self.number_of_nodes = None + self.failures_to_tolerate_and_raid_level = None + + +class RecommendedVmFamilySummary(_serialization.Model): + """The recommended VM family summary. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar azure_vm_family: The Azure VM family. + :vartype azure_vm_family: str + :ivar number_of_machines: The number of machines. + :vartype number_of_machines: int + """ + + _validation = { + "azure_vm_family": {"readonly": True}, + "number_of_machines": {"readonly": True}, + } + + _attribute_map = { + "azure_vm_family": {"key": "azureVmFamily", "type": "str"}, + "number_of_machines": {"key": "numberOfMachines", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.azure_vm_family = None + self.number_of_machines = None + + +class ReportDetails(_serialization.Model): + """Business case report details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar report_type: Report type. Known values are: "Unknown" and "Excel". + :vartype report_type: str or ~azure.mgmt.migrationassessment.models.ReportType + :ivar report_status: Report status. Known values are: "Unknown", "None", "InProgress", + "Failed", and "Completed". + :vartype report_status: str or ~azure.mgmt.migrationassessment.models.ReportStatus + """ + + _validation = { + "report_type": {"readonly": True}, + "report_status": {"readonly": True}, + } + + _attribute_map = { + "report_type": {"key": "reportType", "type": "str"}, + "report_status": {"key": "reportStatus", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.report_type = None + self.report_status = None + + +class ReportDownloadUrl(_serialization.Model): + """Download URL for assessment report. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar business_case_report_url: Hyperlink to download report. + :vartype business_case_report_url: str + :ivar expiration_time: Expiry date of download url. + :vartype expiration_time: ~datetime.datetime + """ + + _validation = { + "business_case_report_url": {"readonly": True}, + "expiration_time": {"readonly": True}, + } + + _attribute_map = { + "business_case_report_url": {"key": "businessCaseReportUrl", "type": "str"}, + "expiration_time": {"key": "expirationTime", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.business_case_report_url = None + self.expiration_time = None + + +class ResourceId(_serialization.Model): + """ARM id for a resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Gets the relative URL to get to this REST resource. + :vartype id: str + """ + + _validation = { + "id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + + +class SecuritySettings(_serialization.Model): + """Security settings. + + All required parameters must be populated in order to send to server. + + :ivar server_security_cost_per_server_per_year: Physical servers per administrator. Required. + :vartype server_security_cost_per_server_per_year: float + :ivar sql_server_security_cost_per_server_per_year: Virtual machines per administrator. + Required. + :vartype sql_server_security_cost_per_server_per_year: float + """ + + _validation = { + "server_security_cost_per_server_per_year": {"required": True}, + "sql_server_security_cost_per_server_per_year": {"required": True}, + } + + _attribute_map = { + "server_security_cost_per_server_per_year": {"key": "serverSecurityCostPerServerPerYear", "type": "float"}, + "sql_server_security_cost_per_server_per_year": { + "key": "sqlServerSecurityCostPerServerPerYear", + "type": "float", + }, + } + + def __init__( + self, + *, + server_security_cost_per_server_per_year: float, + sql_server_security_cost_per_server_per_year: float, + **kwargs: Any + ) -> None: + """ + :keyword server_security_cost_per_server_per_year: Physical servers per administrator. + Required. + :paramtype server_security_cost_per_server_per_year: float + :keyword sql_server_security_cost_per_server_per_year: Virtual machines per administrator. + Required. + :paramtype sql_server_security_cost_per_server_per_year: float + """ + super().__init__(**kwargs) + self.server_security_cost_per_server_per_year = server_security_cost_per_server_per_year + self.sql_server_security_cost_per_server_per_year = sql_server_security_cost_per_server_per_year + + +class ServerCollector(ProxyResource): + """Physical server collector 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.CollectorPropertiesBaseWithAgent + """ + + _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": "CollectorPropertiesBaseWithAgent"}, + } + + def __init__( + self, *, properties: Optional["_models.CollectorPropertiesBaseWithAgent"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.CollectorPropertiesBaseWithAgent + """ + super().__init__(**kwargs) + self.properties = properties + + +class ServerCollectorListResult(_serialization.Model): + """The response of a ServerCollector list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The ServerCollector items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.ServerCollector] + :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": "[ServerCollector]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.ServerCollector"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The ServerCollector items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.ServerCollector] + :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 ServersDiscovered(_serialization.Model): + """Shows the discovered servers by virtualization platform. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar vm_ware: Number of servers on VMWare. + :vartype vm_ware: int + :ivar hyper_v: Number of servers on HyperV. + :vartype hyper_v: int + :ivar physical: Number of physical servers. + :vartype physical: int + :ivar not_applicable: Number of servers whose virtualization is unknown. + :vartype not_applicable: int + """ + + _validation = { + "vm_ware": {"readonly": True}, + "hyper_v": {"readonly": True}, + "physical": {"readonly": True}, + "not_applicable": {"readonly": True}, + } + + _attribute_map = { + "vm_ware": {"key": "vmWare", "type": "int"}, + "hyper_v": {"key": "hyperV", "type": "int"}, + "physical": {"key": "physical", "type": "int"}, + "not_applicable": {"key": "notApplicable", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.vm_ware = None + self.hyper_v = None + self.physical = None + self.not_applicable = None + + +class ServicePackInsight(_serialization.Model): + """Service Pack Insight. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar unknown_service_pack: Unknown support. + :vartype unknown_service_pack: int + :ivar patched: Patched Service Pack Insight. + :vartype patched: int + :ivar unpatched: Unpatched Service Pack Insight. + :vartype unpatched: int + """ + + _validation = { + "unknown_service_pack": {"readonly": True}, + "patched": {"readonly": True}, + "unpatched": {"readonly": True}, + } + + _attribute_map = { + "unknown_service_pack": {"key": "unknownServicePack", "type": "int"}, + "patched": {"key": "patched", "type": "int"}, + "unpatched": {"key": "unpatched", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.unknown_service_pack = None + self.patched = None + self.unpatched = None + + +class Settings(_serialization.Model): + """Business case settings. + + All required parameters must be populated in order to send to server. + + :ivar azure_settings: Azure settings for a business case. Required. + :vartype azure_settings: ~azure.mgmt.migrationassessment.models.AzureSettings + :ivar on_premise_settings: On-premise settings. + :vartype on_premise_settings: ~azure.mgmt.migrationassessment.models.OnPremiseSettings + :ivar azure_arc_settings: Azure arc settings. + :vartype azure_arc_settings: ~azure.mgmt.migrationassessment.models.AzureArcSettings + """ + + _validation = { + "azure_settings": {"required": True}, + } + + _attribute_map = { + "azure_settings": {"key": "azureSettings", "type": "AzureSettings"}, + "on_premise_settings": {"key": "onPremiseSettings", "type": "OnPremiseSettings"}, + "azure_arc_settings": {"key": "azureArcSettings", "type": "AzureArcSettings"}, + } + + def __init__( + self, + *, + azure_settings: "_models.AzureSettings", + on_premise_settings: Optional["_models.OnPremiseSettings"] = None, + azure_arc_settings: Optional["_models.AzureArcSettings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword azure_settings: Azure settings for a business case. Required. + :paramtype azure_settings: ~azure.mgmt.migrationassessment.models.AzureSettings + :keyword on_premise_settings: On-premise settings. + :paramtype on_premise_settings: ~azure.mgmt.migrationassessment.models.OnPremiseSettings + :keyword azure_arc_settings: Azure arc settings. + :paramtype azure_arc_settings: ~azure.mgmt.migrationassessment.models.AzureArcSettings + """ + super().__init__(**kwargs) + self.azure_settings = azure_settings + self.on_premise_settings = on_premise_settings + self.azure_arc_settings = azure_arc_settings + + +class SharedResourcesDTO(_serialization.Model): + """Shared Resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar shared_data_disks: Gets the list of shared data disks. + :vartype shared_data_disks: list[~azure.mgmt.migrationassessment.models.AzureManagedDiskSkuDTO] + :ivar shared_log_disks: Gets the list of shared log disks. + :vartype shared_log_disks: list[~azure.mgmt.migrationassessment.models.AzureManagedDiskSkuDTO] + :ivar shared_temp_db_disks: Gets the list of shared Temporary database disks. + :vartype shared_temp_db_disks: + list[~azure.mgmt.migrationassessment.models.AzureManagedDiskSkuDTO] + :ivar number_of_mounts: Gets number of mounts of shared disks. + :vartype number_of_mounts: int + :ivar quorum_witness: Gets quorum witness. + :vartype quorum_witness: ~azure.mgmt.migrationassessment.models.AzureQuorumWitnessDTO + """ + + _validation = { + "shared_data_disks": {"readonly": True}, + "shared_log_disks": {"readonly": True}, + "shared_temp_db_disks": {"readonly": True}, + "number_of_mounts": {"readonly": True}, + "quorum_witness": {"readonly": True}, + } + + _attribute_map = { + "shared_data_disks": {"key": "sharedDataDisks", "type": "[AzureManagedDiskSkuDTO]"}, + "shared_log_disks": {"key": "sharedLogDisks", "type": "[AzureManagedDiskSkuDTO]"}, + "shared_temp_db_disks": {"key": "sharedTempDbDisks", "type": "[AzureManagedDiskSkuDTO]"}, + "number_of_mounts": {"key": "numberOfMounts", "type": "int"}, + "quorum_witness": {"key": "quorumWitness", "type": "AzureQuorumWitnessDTO"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.shared_data_disks = None + self.shared_log_disks = None + self.shared_temp_db_disks = None + self.number_of_mounts = None + self.quorum_witness = None + + +class SqlAssessedNetworkAdapter(_serialization.Model): + """SQL Assessed Network Adapter. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar suitability: Gets the suitability. Known values are: "Unknown", "NotSuitable", + "Suitable", "ConditionallySuitable", and "ReadinessUnknown". + :vartype suitability: str or ~azure.mgmt.migrationassessment.models.CloudSuitability + :ivar suitability_detail: Gets the suitability detail. Known values are: "None", + "MegabytesOfDataTransmittedMissing", "MegabytesOfDataTransmittedOutOfRange", + "MegabytesOfDataRecievedMissing", and "MegabytesOfDataRecievedOutOfRange". + :vartype suitability_detail: str or + ~azure.mgmt.migrationassessment.models.AzureNetworkAdapterSuitabilityDetail + :ivar suitability_explanation: Gets the suitability explanation. Known values are: "Unknown", + "NotApplicable", and "InternalErrorOccurred". + :vartype suitability_explanation: str or + ~azure.mgmt.migrationassessment.models.AzureNetworkAdapterSuitabilityExplanation + :ivar monthly_bandwidth_costs: Gets the monthly bandwidth costs. + :vartype monthly_bandwidth_costs: float + :ivar net_gigabytes_transmitted_per_month: Gets the net gigabytes transmitted per month. + :vartype net_gigabytes_transmitted_per_month: float + :ivar name: Gets the name. + :vartype name: str + :ivar display_name: Gets the display name. + :vartype display_name: str + :ivar mac_address: Gets the mac address. + :vartype mac_address: str + :ivar ip_addresses: Gets the ip addresses. + :vartype ip_addresses: list[str] + :ivar megabytes_per_second_received: Gets the megabytes per second received. + :vartype megabytes_per_second_received: float + :ivar megabytes_per_second_transmitted: Gets the megabytes per second transmitted. + :vartype megabytes_per_second_transmitted: float + """ + + _validation = { + "ip_addresses": {"readonly": True}, + } + + _attribute_map = { + "suitability": {"key": "suitability", "type": "str"}, + "suitability_detail": {"key": "suitabilityDetail", "type": "str"}, + "suitability_explanation": {"key": "suitabilityExplanation", "type": "str"}, + "monthly_bandwidth_costs": {"key": "monthlyBandwidthCosts", "type": "float"}, + "net_gigabytes_transmitted_per_month": {"key": "netGigabytesTransmittedPerMonth", "type": "float"}, + "name": {"key": "name", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "mac_address": {"key": "macAddress", "type": "str"}, + "ip_addresses": {"key": "ipAddresses", "type": "[str]"}, + "megabytes_per_second_received": {"key": "megabytesPerSecondReceived", "type": "float"}, + "megabytes_per_second_transmitted": {"key": "megabytesPerSecondTransmitted", "type": "float"}, + } + + def __init__( + self, + *, + suitability: Optional[Union[str, "_models.CloudSuitability"]] = None, + suitability_detail: Optional[Union[str, "_models.AzureNetworkAdapterSuitabilityDetail"]] = None, + suitability_explanation: Optional[Union[str, "_models.AzureNetworkAdapterSuitabilityExplanation"]] = None, + monthly_bandwidth_costs: Optional[float] = None, + net_gigabytes_transmitted_per_month: Optional[float] = None, + name: Optional[str] = None, + display_name: Optional[str] = None, + mac_address: Optional[str] = None, + megabytes_per_second_received: Optional[float] = None, + megabytes_per_second_transmitted: Optional[float] = None, + **kwargs: Any + ) -> None: + """ + :keyword suitability: Gets the suitability. Known values are: "Unknown", "NotSuitable", + "Suitable", "ConditionallySuitable", and "ReadinessUnknown". + :paramtype suitability: str or ~azure.mgmt.migrationassessment.models.CloudSuitability + :keyword suitability_detail: Gets the suitability detail. Known values are: "None", + "MegabytesOfDataTransmittedMissing", "MegabytesOfDataTransmittedOutOfRange", + "MegabytesOfDataRecievedMissing", and "MegabytesOfDataRecievedOutOfRange". + :paramtype suitability_detail: str or + ~azure.mgmt.migrationassessment.models.AzureNetworkAdapterSuitabilityDetail + :keyword suitability_explanation: Gets the suitability explanation. Known values are: + "Unknown", "NotApplicable", and "InternalErrorOccurred". + :paramtype suitability_explanation: str or + ~azure.mgmt.migrationassessment.models.AzureNetworkAdapterSuitabilityExplanation + :keyword monthly_bandwidth_costs: Gets the monthly bandwidth costs. + :paramtype monthly_bandwidth_costs: float + :keyword net_gigabytes_transmitted_per_month: Gets the net gigabytes transmitted per month. + :paramtype net_gigabytes_transmitted_per_month: float + :keyword name: Gets the name. + :paramtype name: str + :keyword display_name: Gets the display name. + :paramtype display_name: str + :keyword mac_address: Gets the mac address. + :paramtype mac_address: str + :keyword megabytes_per_second_received: Gets the megabytes per second received. + :paramtype megabytes_per_second_received: float + :keyword megabytes_per_second_transmitted: Gets the megabytes per second transmitted. + :paramtype megabytes_per_second_transmitted: float + """ + super().__init__(**kwargs) + self.suitability = suitability + self.suitability_detail = suitability_detail + self.suitability_explanation = suitability_explanation + self.monthly_bandwidth_costs = monthly_bandwidth_costs + self.net_gigabytes_transmitted_per_month = net_gigabytes_transmitted_per_month + self.name = name + self.display_name = display_name + self.mac_address = mac_address + self.ip_addresses = None + self.megabytes_per_second_received = megabytes_per_second_received + self.megabytes_per_second_transmitted = megabytes_per_second_transmitted + + +class SqlAssessmentMigrationIssue(_serialization.Model): + """Class representing the SQL migration issues. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar issue_id: Gets the issue id. + :vartype issue_id: str + :ivar issue_category: Gets the issue category. Known values are: "Issue", "Warning", and + "Internal". + :vartype issue_category: str or + ~azure.mgmt.migrationassessment.models.SqlAssessmentMigrationIssueCategory + :ivar impacted_objects: Gets the list of impacted objects. + :vartype impacted_objects: + list[~azure.mgmt.migrationassessment.models.ImpactedAssessmentObject] + """ + + _validation = { + "issue_id": {"readonly": True}, + "issue_category": {"readonly": True}, + "impacted_objects": {"readonly": True}, + } + + _attribute_map = { + "issue_id": {"key": "issueId", "type": "str"}, + "issue_category": {"key": "issueCategory", "type": "str"}, + "impacted_objects": {"key": "impactedObjects", "type": "[ImpactedAssessmentObject]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.issue_id = None + self.issue_category = None + self.impacted_objects = None + + +class SqlAssessmentOptions(ProxyResource): + """SQL Assessment options web model object. + + 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.SqlAssessmentOptionsProperties + """ + + _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": "SqlAssessmentOptionsProperties"}, + } + + def __init__(self, *, properties: Optional["_models.SqlAssessmentOptionsProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.SqlAssessmentOptionsProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class SqlAssessmentOptionsListResult(_serialization.Model): + """The response of a SqlAssessmentOptions list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The SqlAssessmentOptions items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.SqlAssessmentOptions] + :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": "[SqlAssessmentOptions]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.SqlAssessmentOptions"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The SqlAssessmentOptions items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.SqlAssessmentOptions] + :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 SqlAssessmentOptionsProperties(_serialization.Model): + """SQL Assessment options properties Web model object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar vm_families: Gets the list of VM families. + :vartype vm_families: list[~azure.mgmt.migrationassessment.models.VmFamilyOptions] + :ivar reserved_instance_vm_families: Gets the Reserved Instance VM Families list. + :vartype reserved_instance_vm_families: list[str or + ~azure.mgmt.migrationassessment.models.AzureVmFamily] + :ivar premium_disk_vm_families: Gets the Premium disk VM Families list. + :vartype premium_disk_vm_families: list[str or + ~azure.mgmt.migrationassessment.models.AzureVmFamily] + :ivar savings_plan_vm_families: Gets or sets the Premium disk VM Families list. + :vartype savings_plan_vm_families: list[str or + ~azure.mgmt.migrationassessment.models.AzureVmFamily] + :ivar savings_plan_supported_locations: Gets or sets the list of Azure locations supporting + Saving Plans for IAAS. + :vartype savings_plan_supported_locations: list[str or + ~azure.mgmt.migrationassessment.models.AzureLocation] + :ivar savings_plan_supported_locations_for_paas: Gets or sets the list of Azure locations + supporting Saving Plans for PAAS. + :vartype savings_plan_supported_locations_for_paas: list[str or + ~azure.mgmt.migrationassessment.models.AzureLocation] + :ivar reserved_instance_supported_locations_for_iaas: Gets or sets the list of Azure locations + supporting Reserved Instances for IAAS. + :vartype reserved_instance_supported_locations_for_iaas: list[str or + ~azure.mgmt.migrationassessment.models.AzureLocation] + :ivar savings_plan_supported_offers: Gets or sets the list of Azure Offers supporting Saving + Plans. + :vartype savings_plan_supported_offers: list[str or + ~azure.mgmt.migrationassessment.models.AzureOfferCode] + :ivar sql_skus: Gets or sets the list of SQL target SKU properties for dropdowns. + :vartype sql_skus: list[~azure.mgmt.migrationassessment.models.SqlPaaSTargetOptions] + :ivar reserved_instance_sql_targets: Gets or sets the Reserved Instance SQL target types. + :vartype reserved_instance_sql_targets: list[str or + ~azure.mgmt.migrationassessment.models.TargetType] + :ivar reserved_instance_supported_locations: Gets or sets the list of Azure locations + supporting Reserved Instances. + :vartype reserved_instance_supported_locations: list[str or + ~azure.mgmt.migrationassessment.models.AzureLocation] + :ivar reserved_instance_supported_currencies: Gets or sets the list of currencies supported for + Reserved Instances. + :vartype reserved_instance_supported_currencies: list[str or + ~azure.mgmt.migrationassessment.models.AzureCurrency] + :ivar reserved_instance_supported_offers: Gets or sets the list of offers supported for + Reserved Instances. + :vartype reserved_instance_supported_offers: list[str or + ~azure.mgmt.migrationassessment.models.AzureOfferCode] + :ivar supported_offers: Gets or sets the list of offers supported for SQL assessments. + :vartype supported_offers: list[str or ~azure.mgmt.migrationassessment.models.AzureOfferCode] + """ + + _validation = { + "vm_families": {"readonly": True}, + "reserved_instance_vm_families": {"readonly": True}, + "premium_disk_vm_families": {"readonly": True}, + } + + _attribute_map = { + "vm_families": {"key": "vmFamilies", "type": "[VmFamilyOptions]"}, + "reserved_instance_vm_families": {"key": "reservedInstanceVmFamilies", "type": "[str]"}, + "premium_disk_vm_families": {"key": "premiumDiskVmFamilies", "type": "[str]"}, + "savings_plan_vm_families": {"key": "savingsPlanVmFamilies", "type": "[str]"}, + "savings_plan_supported_locations": {"key": "savingsPlanSupportedLocations", "type": "[str]"}, + "savings_plan_supported_locations_for_paas": {"key": "savingsPlanSupportedLocationsForPaas", "type": "[str]"}, + "reserved_instance_supported_locations_for_iaas": { + "key": "reservedInstanceSupportedLocationsForIaas", + "type": "[str]", + }, + "savings_plan_supported_offers": {"key": "savingsPlanSupportedOffers", "type": "[str]"}, + "sql_skus": {"key": "sqlSkus", "type": "[SqlPaaSTargetOptions]"}, + "reserved_instance_sql_targets": {"key": "reservedInstanceSqlTargets", "type": "[str]"}, + "reserved_instance_supported_locations": {"key": "reservedInstanceSupportedLocations", "type": "[str]"}, + "reserved_instance_supported_currencies": {"key": "reservedInstanceSupportedCurrencies", "type": "[str]"}, + "reserved_instance_supported_offers": {"key": "reservedInstanceSupportedOffers", "type": "[str]"}, + "supported_offers": {"key": "supportedOffers", "type": "[str]"}, + } + + def __init__( + self, + *, + savings_plan_vm_families: Optional[List[Union[str, "_models.AzureVmFamily"]]] = None, + savings_plan_supported_locations: Optional[List[Union[str, "_models.AzureLocation"]]] = None, + savings_plan_supported_locations_for_paas: Optional[List[Union[str, "_models.AzureLocation"]]] = None, + reserved_instance_supported_locations_for_iaas: Optional[List[Union[str, "_models.AzureLocation"]]] = None, + savings_plan_supported_offers: Optional[List[Union[str, "_models.AzureOfferCode"]]] = None, + sql_skus: Optional[List["_models.SqlPaaSTargetOptions"]] = None, + reserved_instance_sql_targets: Optional[List[Union[str, "_models.TargetType"]]] = None, + reserved_instance_supported_locations: Optional[List[Union[str, "_models.AzureLocation"]]] = None, + reserved_instance_supported_currencies: Optional[List[Union[str, "_models.AzureCurrency"]]] = None, + reserved_instance_supported_offers: Optional[List[Union[str, "_models.AzureOfferCode"]]] = None, + supported_offers: Optional[List[Union[str, "_models.AzureOfferCode"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword savings_plan_vm_families: Gets or sets the Premium disk VM Families list. + :paramtype savings_plan_vm_families: list[str or + ~azure.mgmt.migrationassessment.models.AzureVmFamily] + :keyword savings_plan_supported_locations: Gets or sets the list of Azure locations supporting + Saving Plans for IAAS. + :paramtype savings_plan_supported_locations: list[str or + ~azure.mgmt.migrationassessment.models.AzureLocation] + :keyword savings_plan_supported_locations_for_paas: Gets or sets the list of Azure locations + supporting Saving Plans for PAAS. + :paramtype savings_plan_supported_locations_for_paas: list[str or + ~azure.mgmt.migrationassessment.models.AzureLocation] + :keyword reserved_instance_supported_locations_for_iaas: Gets or sets the list of Azure + locations supporting Reserved Instances for IAAS. + :paramtype reserved_instance_supported_locations_for_iaas: list[str or + ~azure.mgmt.migrationassessment.models.AzureLocation] + :keyword savings_plan_supported_offers: Gets or sets the list of Azure Offers supporting Saving + Plans. + :paramtype savings_plan_supported_offers: list[str or + ~azure.mgmt.migrationassessment.models.AzureOfferCode] + :keyword sql_skus: Gets or sets the list of SQL target SKU properties for dropdowns. + :paramtype sql_skus: list[~azure.mgmt.migrationassessment.models.SqlPaaSTargetOptions] + :keyword reserved_instance_sql_targets: Gets or sets the Reserved Instance SQL target types. + :paramtype reserved_instance_sql_targets: list[str or + ~azure.mgmt.migrationassessment.models.TargetType] + :keyword reserved_instance_supported_locations: Gets or sets the list of Azure locations + supporting Reserved Instances. + :paramtype reserved_instance_supported_locations: list[str or + ~azure.mgmt.migrationassessment.models.AzureLocation] + :keyword reserved_instance_supported_currencies: Gets or sets the list of currencies supported + for Reserved Instances. + :paramtype reserved_instance_supported_currencies: list[str or + ~azure.mgmt.migrationassessment.models.AzureCurrency] + :keyword reserved_instance_supported_offers: Gets or sets the list of offers supported for + Reserved Instances. + :paramtype reserved_instance_supported_offers: list[str or + ~azure.mgmt.migrationassessment.models.AzureOfferCode] + :keyword supported_offers: Gets or sets the list of offers supported for SQL assessments. + :paramtype supported_offers: list[str or ~azure.mgmt.migrationassessment.models.AzureOfferCode] + """ + super().__init__(**kwargs) + self.vm_families = None + self.reserved_instance_vm_families = None + self.premium_disk_vm_families = None + self.savings_plan_vm_families = savings_plan_vm_families + self.savings_plan_supported_locations = savings_plan_supported_locations + self.savings_plan_supported_locations_for_paas = savings_plan_supported_locations_for_paas + self.reserved_instance_supported_locations_for_iaas = reserved_instance_supported_locations_for_iaas + self.savings_plan_supported_offers = savings_plan_supported_offers + self.sql_skus = sql_skus + self.reserved_instance_sql_targets = reserved_instance_sql_targets + self.reserved_instance_supported_locations = reserved_instance_supported_locations + self.reserved_instance_supported_currencies = reserved_instance_supported_currencies + self.reserved_instance_supported_offers = reserved_instance_supported_offers + self.supported_offers = supported_offers + + +class SqlAssessmentV2(ProxyResource): + """SQL Assessment REST 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.SqlAssessmentV2Properties + """ + + _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": "SqlAssessmentV2Properties"}, + } + + def __init__(self, *, properties: Optional["_models.SqlAssessmentV2Properties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.SqlAssessmentV2Properties + """ + super().__init__(**kwargs) + self.properties = properties + + +class SqlAssessmentV2IaasSuitabilityData(_serialization.Model): + """Class representing Azure SQL IAAS suitability details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar azure_sql_sku: Gets the azure SQL IAAS SKU. + :vartype azure_sql_sku: ~azure.mgmt.migrationassessment.models.AzureSqlIaasSkuDTO + :ivar replica_azure_sql_sku: Gets the replica azure SQL IAAS SKU. + :vartype replica_azure_sql_sku: list[~azure.mgmt.migrationassessment.models.AzureSqlIaasSkuDTO] + :ivar shared_resources: Gets the shared resources. + :vartype shared_resources: ~azure.mgmt.migrationassessment.models.SharedResourcesDTO + :ivar monthly_compute_cost: Gets the monthly compute cost. + :vartype monthly_compute_cost: float + :ivar monthly_storage_cost: Gets the monthly storage cost. + :vartype monthly_storage_cost: float + :ivar cost_components: Gets the collection of cost components. + :vartype cost_components: list[~azure.mgmt.migrationassessment.models.CostComponent] + :ivar security_suitability: Gets the suitability for Microsoft cloud defender. Known values + are: "Unknown", "NotSuitable", "Suitable", "ConditionallySuitable", and "ReadinessUnknown". + :vartype security_suitability: str or ~azure.mgmt.migrationassessment.models.CloudSuitability + :ivar should_provision_replicas: Gets a value indicating whether replicas should be + provisioned. + :vartype should_provision_replicas: bool + :ivar sku_replication_mode: Gets the replication mode. Known values are: "NotApplicable", + "ActiveGeoReplication", and "FailoverGroupInstance". + :vartype sku_replication_mode: str or ~azure.mgmt.migrationassessment.models.SkuReplicationMode + :ivar migration_guidelines: Gets the list of migration guidelines applicable to this target. + :vartype migration_guidelines: + list[~azure.mgmt.migrationassessment.models.SqlMigrationGuideline] + :ivar recommendation_reasonings: Gets the list of SQL recommendation Reasoning. + :vartype recommendation_reasonings: + list[~azure.mgmt.migrationassessment.models.SqlRecommendationReasoning] + :ivar migration_target_platform: Gets the migration target platform. Known values are: + "Unknown", "Recommended", "AzureSqlDatabase", "AzureSqlManagedInstance", + "AzureSqlVirtualMachine", and "AzureVirtualMachine". + :vartype migration_target_platform: str or ~azure.mgmt.migrationassessment.models.TargetType + :ivar suitability: Gets the azure suitability. Known values are: "Unknown", "NotSuitable", + "Suitable", "ConditionallySuitable", and "ReadinessUnknown". + :vartype suitability: str or ~azure.mgmt.migrationassessment.models.CloudSuitability + :ivar migration_issues: Gets the list of migrations issues. + :vartype migration_issues: + list[~azure.mgmt.migrationassessment.models.SqlAssessmentMigrationIssue] + """ + + _validation = { + "azure_sql_sku": {"readonly": True}, + "replica_azure_sql_sku": {"readonly": True}, + "shared_resources": {"readonly": True}, + "monthly_compute_cost": {"readonly": True}, + "monthly_storage_cost": {"readonly": True}, + "security_suitability": {"readonly": True}, + "should_provision_replicas": {"readonly": True}, + "sku_replication_mode": {"readonly": True}, + "migration_guidelines": {"readonly": True}, + "recommendation_reasonings": {"readonly": True}, + "migration_target_platform": {"readonly": True}, + "suitability": {"readonly": True}, + "migration_issues": {"readonly": True}, + } + + _attribute_map = { + "azure_sql_sku": {"key": "azureSqlSku", "type": "AzureSqlIaasSkuDTO"}, + "replica_azure_sql_sku": {"key": "replicaAzureSqlSku", "type": "[AzureSqlIaasSkuDTO]"}, + "shared_resources": {"key": "sharedResources", "type": "SharedResourcesDTO"}, + "monthly_compute_cost": {"key": "monthlyComputeCost", "type": "float"}, + "monthly_storage_cost": {"key": "monthlyStorageCost", "type": "float"}, + "cost_components": {"key": "costComponents", "type": "[CostComponent]"}, + "security_suitability": {"key": "securitySuitability", "type": "str"}, + "should_provision_replicas": {"key": "shouldProvisionReplicas", "type": "bool"}, + "sku_replication_mode": {"key": "skuReplicationMode", "type": "str"}, + "migration_guidelines": {"key": "migrationGuidelines", "type": "[SqlMigrationGuideline]"}, + "recommendation_reasonings": {"key": "recommendationReasonings", "type": "[SqlRecommendationReasoning]"}, + "migration_target_platform": {"key": "migrationTargetPlatform", "type": "str"}, + "suitability": {"key": "suitability", "type": "str"}, + "migration_issues": {"key": "migrationIssues", "type": "[SqlAssessmentMigrationIssue]"}, + } + + def __init__(self, *, cost_components: Optional[List["_models.CostComponent"]] = None, **kwargs: Any) -> None: + """ + :keyword cost_components: Gets the collection of cost components. + :paramtype cost_components: list[~azure.mgmt.migrationassessment.models.CostComponent] + """ + super().__init__(**kwargs) + self.azure_sql_sku = None + self.replica_azure_sql_sku = None + self.shared_resources = None + self.monthly_compute_cost = None + self.monthly_storage_cost = None + self.cost_components = cost_components + self.security_suitability = None + self.should_provision_replicas = None + self.sku_replication_mode = None + self.migration_guidelines = None + self.recommendation_reasonings = None + self.migration_target_platform = None + self.suitability = None + self.migration_issues = None + + +class SqlAssessmentV2ListResult(_serialization.Model): + """The response of a SqlAssessmentV2 list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The SqlAssessmentV2 items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.SqlAssessmentV2] + :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": "[SqlAssessmentV2]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.SqlAssessmentV2"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The SqlAssessmentV2 items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.SqlAssessmentV2] + :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 SqlAssessmentV2PaasSuitabilityData(_serialization.Model): + """Class representing Azure SQL PAAS suitability details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar azure_sql_sku: Gets the azure SQL PAAS SKU. + :vartype azure_sql_sku: ~azure.mgmt.migrationassessment.models.AzureSqlPaasSkuDTO + :ivar replica_azure_sql_sku: Gets the replica azure SQL PAAS SKU. + :vartype replica_azure_sql_sku: list[~azure.mgmt.migrationassessment.models.AzureSqlPaasSkuDTO] + :ivar shared_resources: Gets the shared resources. + :vartype shared_resources: ~azure.mgmt.migrationassessment.models.SharedResourcesDTO + :ivar monthly_compute_cost: Gets the monthly compute cost. + :vartype monthly_compute_cost: float + :ivar monthly_storage_cost: Gets the monthly storage cost. + :vartype monthly_storage_cost: float + :ivar cost_components: Gets the collection of cost components. + :vartype cost_components: list[~azure.mgmt.migrationassessment.models.CostComponent] + :ivar security_suitability: Gets the suitability for Microsoft cloud defender. Known values + are: "Unknown", "NotSuitable", "Suitable", "ConditionallySuitable", and "ReadinessUnknown". + :vartype security_suitability: str or ~azure.mgmt.migrationassessment.models.CloudSuitability + :ivar should_provision_replicas: Gets a value indicating whether replicas should be + provisioned. + :vartype should_provision_replicas: bool + :ivar sku_replication_mode: Gets the replication mode. Known values are: "NotApplicable", + "ActiveGeoReplication", and "FailoverGroupInstance". + :vartype sku_replication_mode: str or ~azure.mgmt.migrationassessment.models.SkuReplicationMode + :ivar migration_guidelines: Gets the list of migration guidelines applicable to this target. + :vartype migration_guidelines: + list[~azure.mgmt.migrationassessment.models.SqlMigrationGuideline] + :ivar recommendation_reasonings: Gets the list of SQL recommendation Reasoning. + :vartype recommendation_reasonings: + list[~azure.mgmt.migrationassessment.models.SqlRecommendationReasoning] + :ivar migration_target_platform: Gets the migration target platform. Known values are: + "Unknown", "Recommended", "AzureSqlDatabase", "AzureSqlManagedInstance", + "AzureSqlVirtualMachine", and "AzureVirtualMachine". + :vartype migration_target_platform: str or ~azure.mgmt.migrationassessment.models.TargetType + :ivar suitability: Gets the azure suitability. Known values are: "Unknown", "NotSuitable", + "Suitable", "ConditionallySuitable", and "ReadinessUnknown". + :vartype suitability: str or ~azure.mgmt.migrationassessment.models.CloudSuitability + :ivar migration_issues: Gets the list of migrations issues. + :vartype migration_issues: + list[~azure.mgmt.migrationassessment.models.SqlAssessmentMigrationIssue] + """ + + _validation = { + "azure_sql_sku": {"readonly": True}, + "replica_azure_sql_sku": {"readonly": True}, + "shared_resources": {"readonly": True}, + "monthly_compute_cost": {"readonly": True}, + "monthly_storage_cost": {"readonly": True}, + "security_suitability": {"readonly": True}, + "should_provision_replicas": {"readonly": True}, + "sku_replication_mode": {"readonly": True}, + "migration_guidelines": {"readonly": True}, + "recommendation_reasonings": {"readonly": True}, + "migration_target_platform": {"readonly": True}, + "suitability": {"readonly": True}, + "migration_issues": {"readonly": True}, + } + + _attribute_map = { + "azure_sql_sku": {"key": "azureSqlSku", "type": "AzureSqlPaasSkuDTO"}, + "replica_azure_sql_sku": {"key": "replicaAzureSqlSku", "type": "[AzureSqlPaasSkuDTO]"}, + "shared_resources": {"key": "sharedResources", "type": "SharedResourcesDTO"}, + "monthly_compute_cost": {"key": "monthlyComputeCost", "type": "float"}, + "monthly_storage_cost": {"key": "monthlyStorageCost", "type": "float"}, + "cost_components": {"key": "costComponents", "type": "[CostComponent]"}, + "security_suitability": {"key": "securitySuitability", "type": "str"}, + "should_provision_replicas": {"key": "shouldProvisionReplicas", "type": "bool"}, + "sku_replication_mode": {"key": "skuReplicationMode", "type": "str"}, + "migration_guidelines": {"key": "migrationGuidelines", "type": "[SqlMigrationGuideline]"}, + "recommendation_reasonings": {"key": "recommendationReasonings", "type": "[SqlRecommendationReasoning]"}, + "migration_target_platform": {"key": "migrationTargetPlatform", "type": "str"}, + "suitability": {"key": "suitability", "type": "str"}, + "migration_issues": {"key": "migrationIssues", "type": "[SqlAssessmentMigrationIssue]"}, + } + + def __init__(self, *, cost_components: Optional[List["_models.CostComponent"]] = None, **kwargs: Any) -> None: + """ + :keyword cost_components: Gets the collection of cost components. + :paramtype cost_components: list[~azure.mgmt.migrationassessment.models.CostComponent] + """ + super().__init__(**kwargs) + self.azure_sql_sku = None + self.replica_azure_sql_sku = None + self.shared_resources = None + self.monthly_compute_cost = None + self.monthly_storage_cost = None + self.cost_components = cost_components + self.security_suitability = None + self.should_provision_replicas = None + self.sku_replication_mode = None + self.migration_guidelines = None + self.recommendation_reasonings = None + self.migration_target_platform = None + self.suitability = None + self.migration_issues = None + + +class SqlAssessmentV2Properties(AzureResourceProperties): + """SQL assessment properties class. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningState + :ivar os_license: Gets or sets user configurable setting to display the azure hybrid use + benefit. Known values are: "Unknown", "Yes", and "No". + :vartype os_license: str or ~azure.mgmt.migrationassessment.models.OsLicense + :ivar environment_type: Gets or sets user configurable setting to display the environment type. + Known values are: "Production" and "Test". + :vartype environment_type: str or ~azure.mgmt.migrationassessment.models.EnvironmentType + :ivar entity_uptime: Gets or sets the duration for which the entity (SQL, VMs) are up in the + on-premises environment. + :vartype entity_uptime: ~azure.mgmt.migrationassessment.models.EntityUptime + :ivar optimization_logic: Gets or sets SQL optimization logic. Known values are: + "MinimizeCost", "ModernizeToPaaS", "ModernizeToAzureSqlMi", and "ModernizeToAzureSqlDb". + :vartype optimization_logic: str or ~azure.mgmt.migrationassessment.models.OptimizationLogic + :ivar reserved_instance_for_vm: Gets or sets azure reserved instance for VM. Known values are: + "None", "RI1Year", and "RI3Year". + :vartype reserved_instance_for_vm: str or + ~azure.mgmt.migrationassessment.models.AzureReservedInstance + :ivar azure_offer_code_for_vm: Gets or sets Azure Offer Code for VM. Known values are: + "Unknown", "MSAZR0003P", "MSAZR0044P", "MSAZR0059P", "MSAZR0060P", "MSAZR0062P", "MSAZR0063P", + "MSAZR0064P", "MSAZR0029P", "MSAZR0022P", "MSAZR0023P", "MSAZR0148P", "MSAZR0025P", + "MSAZR0036P", "MSAZR0120P", "MSAZR0121P", "MSAZR0122P", "MSAZR0123P", "MSAZR0124P", + "MSAZR0125P", "MSAZR0126P", "MSAZR0127P", "MSAZR0128P", "MSAZR0129P", "MSAZR0130P", + "MSAZR0111P", "MSAZR0144P", "MSAZR0149P", "MSMCAZR0044P", "MSMCAZR0059P", "MSMCAZR0060P", + "MSMCAZR0063P", "MSMCAZR0120P", "MSMCAZR0121P", "MSMCAZR0125P", "MSMCAZR0128P", "MSAZRDE0003P", + "MSAZRDE0044P", "MSAZRUSGOV0003P", "EA", "MSAZR0243P", "SavingsPlan1Year", and + "SavingsPlan3Year". + :vartype azure_offer_code_for_vm: str or ~azure.mgmt.migrationassessment.models.AzureOfferCode + :ivar ea_subscription_id: Gets or sets the Enterprise agreement subscription id. + :vartype ea_subscription_id: str + :ivar azure_sql_managed_instance_settings: Gets or sets user configurable SQL managed instance + settings. + :vartype azure_sql_managed_instance_settings: + ~azure.mgmt.migrationassessment.models.SqlMiSettings + :ivar azure_sql_database_settings: Gets or sets user configurable SQL database settings. + :vartype azure_sql_database_settings: ~azure.mgmt.migrationassessment.models.SqlDbSettings + :ivar azure_sql_vm_settings: Gets or sets user configurable SQL VM settings. + :vartype azure_sql_vm_settings: ~azure.mgmt.migrationassessment.models.SqlVmSettings + :ivar multi_subnet_intent: Gets or sets user preference indicating intent of multi-subnet + configuration. Known values are: "None", "HighAvailability", and "DisasterRecovery". + :vartype multi_subnet_intent: str or ~azure.mgmt.migrationassessment.models.MultiSubnetIntent + :ivar async_commit_mode_intent: Gets or sets user preference indicating intent of async commit + mode. Known values are: "None", "HighAvailability", and "DisasterRecovery". + :vartype async_commit_mode_intent: str or + ~azure.mgmt.migrationassessment.models.AsyncCommitModeIntent + :ivar is_internet_access_available: Gets or sets a value indicating whether internet access is + available. + :vartype is_internet_access_available: bool + :ivar disaster_recovery_location: Gets or sets the Azure Location or Azure region where to + which the machines + will be migrated. Known values are: "Unknown", "EastAsia", "SoutheastAsia", "AustraliaEast", + "AustraliaSoutheast", "BrazilSouth", "CanadaCentral", "CanadaEast", "WestEurope", + "NorthEurope", "CentralIndia", "SouthIndia", "WestIndia", "JapanEast", "JapanWest", + "KoreaCentral", "KoreaSouth", "UkWest", "UkSouth", "NorthCentralUs", "EastUs", "WestUs2", + "SouthCentralUs", "CentralUs", "EastUs2", "WestUs", "WestCentralUs", "GermanyCentral", + "GermanyNortheast", "ChinaNorth", "ChinaEast", "USGovArizona", "USGovTexas", "USGovIowa", + "USGovVirginia", "USDoDCentral", "USDoDEast", "FranceCentral", "AustraliaCentral", + "SouthAfricaNorth", "FranceSouth", "AustraliaCentral2", "SouthAfricaWest", "GermanyNorth", + "GermanyWestCentral", "NorwayEast", "NorwayWest", "ChinaEast2", "ChinaNorth2", + "SwitzerlandNorth", "SwitzerlandWest", "UAENorth", "UAECentral", "UsNatEast", "UsNatWest", + "UsSecEast", "UsSecCentral", "UsSecWest", "SwedenCentral", and "QatarCentral". + :vartype disaster_recovery_location: str or + ~azure.mgmt.migrationassessment.models.AzureLocation + :ivar enable_hadr_assessment: Gets or sets a value indicating whether HADR assessments needs to + be created. + :vartype enable_hadr_assessment: bool + :ivar azure_security_offering_type: Gets or sets a value indicating azure security offering + type. Known values are: "NO" and "MDC". + :vartype azure_security_offering_type: str or + ~azure.mgmt.migrationassessment.models.AzureSecurityOfferingType + :ivar reserved_instance: Reserved instance. Known values are: "None", "RI1Year", and "RI3Year". + :vartype reserved_instance: str or ~azure.mgmt.migrationassessment.models.AzureReservedInstance + :ivar sql_server_license: SQL server license. Known values are: "Unknown", "Yes", and "No". + :vartype sql_server_license: str or ~azure.mgmt.migrationassessment.models.SqlServerLicense + :ivar group_type: Gets the group type for the assessment. Known values are: "Default", + "Import", and "Import". + :vartype group_type: str or ~azure.mgmt.migrationassessment.models.GroupType + :ivar assessment_type: Assessment type of the assessment. Known values are: "Unknown", + "MachineAssessment", "AvsAssessment", "SqlAssessment", and "WebAppAssessment". + :vartype assessment_type: str or ~azure.mgmt.migrationassessment.models.AssessmentType + :ivar azure_location: Azure Location or Azure region where to which the machines will be + migrated. + :vartype azure_location: str + :ivar azure_offer_code: Azure Offer Code. Known values are: "Unknown", "MSAZR0003P", + "MSAZR0044P", "MSAZR0059P", "MSAZR0060P", "MSAZR0062P", "MSAZR0063P", "MSAZR0064P", + "MSAZR0029P", "MSAZR0022P", "MSAZR0023P", "MSAZR0148P", "MSAZR0025P", "MSAZR0036P", + "MSAZR0120P", "MSAZR0121P", "MSAZR0122P", "MSAZR0123P", "MSAZR0124P", "MSAZR0125P", + "MSAZR0126P", "MSAZR0127P", "MSAZR0128P", "MSAZR0129P", "MSAZR0130P", "MSAZR0111P", + "MSAZR0144P", "MSAZR0149P", "MSMCAZR0044P", "MSMCAZR0059P", "MSMCAZR0060P", "MSMCAZR0063P", + "MSMCAZR0120P", "MSMCAZR0121P", "MSMCAZR0125P", "MSMCAZR0128P", "MSAZRDE0003P", "MSAZRDE0044P", + "MSAZRUSGOV0003P", "EA", "MSAZR0243P", "SavingsPlan1Year", and "SavingsPlan3Year". + :vartype azure_offer_code: str or ~azure.mgmt.migrationassessment.models.AzureOfferCode + :ivar currency: Currency in which prices should be reported. Known values are: "Unknown", + "USD", "DKK", "CAD", "IDR", "JPY", "KRW", "NZD", "NOK", "RUB", "SAR", "ZAR", "SEK", "TRY", + "GBP", "MXN", "MYR", "INR", "HKD", "BRL", "TWD", "EUR", "CHF", "ARS", "AUD", "CNY", and "TRY". + :vartype currency: str or ~azure.mgmt.migrationassessment.models.AzureCurrency + :ivar scaling_factor: Percentage of buffer that user wants on performance metrics when + recommending + Azure sizes. + :vartype scaling_factor: float + :ivar percentile: Percentile of the utilization data values to be considered while assessing + machines. Known values are: "Percentile50", "Percentile90", "Percentile95", and + "Percentile99". + :vartype percentile: str or ~azure.mgmt.migrationassessment.models.Percentile + :ivar time_range: Time Range for which the historic utilization data should be considered for + assessment. Known values are: "Day", "Week", "Month", and "Custom". + :vartype time_range: str or ~azure.mgmt.migrationassessment.models.TimeRange + :ivar perf_data_start_time: Gets or sets the start time to consider performance data for + assessment. + :vartype perf_data_start_time: ~datetime.datetime + :ivar perf_data_end_time: Gets or sets the end time to consider performance data for + assessment. + :vartype perf_data_end_time: ~datetime.datetime + :ivar stage: User configurable setting to display the Stage of Assessment. Known values are: + "InProgress", "UnderReview", and "Approved". + :vartype stage: str or ~azure.mgmt.migrationassessment.models.AssessmentStage + :ivar discount_percentage: Custom discount percentage. + :vartype discount_percentage: float + :ivar sizing_criterion: Assessment sizing criterion. Known values are: "PerformanceBased" and + "AsOnPremises". + :vartype sizing_criterion: str or + ~azure.mgmt.migrationassessment.models.AssessmentSizingCriterion + :ivar confidence_rating_in_percentage: Confidence Rating in Percentage. + :vartype confidence_rating_in_percentage: float + :ivar prices_timestamp: Last time when rates were queried. + :vartype prices_timestamp: ~datetime.datetime + :ivar created_timestamp: Date and Time when assessment was created. + :vartype created_timestamp: ~datetime.datetime + :ivar updated_timestamp: Date and Time when assessment was last updated. + :vartype updated_timestamp: ~datetime.datetime + :ivar status: Whether assessment is in valid state and all machines have been assessed. Known + values are: "Created", "Updated", "Running", "Completed", "Invalid", "OutOfSync", "OutDated", + and "Deleted". + :vartype status: str or ~azure.mgmt.migrationassessment.models.AssessmentStatus + :ivar schema_version: Schema version. + :vartype schema_version: str + """ + + _validation = { + "stage": {"readonly": True}, + "prices_timestamp": {"readonly": True}, + "created_timestamp": {"readonly": True}, + "updated_timestamp": {"readonly": True}, + "status": {"readonly": True}, + "schema_version": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "os_license": {"key": "osLicense", "type": "str"}, + "environment_type": {"key": "environmentType", "type": "str"}, + "entity_uptime": {"key": "entityUptime", "type": "EntityUptime"}, + "optimization_logic": {"key": "optimizationLogic", "type": "str"}, + "reserved_instance_for_vm": {"key": "reservedInstanceForVm", "type": "str"}, + "azure_offer_code_for_vm": {"key": "azureOfferCodeForVm", "type": "str"}, + "ea_subscription_id": {"key": "eaSubscriptionId", "type": "str"}, + "azure_sql_managed_instance_settings": {"key": "azureSqlManagedInstanceSettings", "type": "SqlMiSettings"}, + "azure_sql_database_settings": {"key": "azureSqlDatabaseSettings", "type": "SqlDbSettings"}, + "azure_sql_vm_settings": {"key": "azureSqlVmSettings", "type": "SqlVmSettings"}, + "multi_subnet_intent": {"key": "multiSubnetIntent", "type": "str"}, + "async_commit_mode_intent": {"key": "asyncCommitModeIntent", "type": "str"}, + "is_internet_access_available": {"key": "isInternetAccessAvailable", "type": "bool"}, + "disaster_recovery_location": {"key": "disasterRecoveryLocation", "type": "str"}, + "enable_hadr_assessment": {"key": "enableHadrAssessment", "type": "bool"}, + "azure_security_offering_type": {"key": "azureSecurityOfferingType", "type": "str"}, + "reserved_instance": {"key": "reservedInstance", "type": "str"}, + "sql_server_license": {"key": "sqlServerLicense", "type": "str"}, + "group_type": {"key": "groupType", "type": "str"}, + "assessment_type": {"key": "assessmentType", "type": "str"}, + "azure_location": {"key": "azureLocation", "type": "str"}, + "azure_offer_code": {"key": "azureOfferCode", "type": "str"}, + "currency": {"key": "currency", "type": "str"}, + "scaling_factor": {"key": "scalingFactor", "type": "float"}, + "percentile": {"key": "percentile", "type": "str"}, + "time_range": {"key": "timeRange", "type": "str"}, + "perf_data_start_time": {"key": "perfDataStartTime", "type": "iso-8601"}, + "perf_data_end_time": {"key": "perfDataEndTime", "type": "iso-8601"}, + "stage": {"key": "stage", "type": "str"}, + "discount_percentage": {"key": "discountPercentage", "type": "float"}, + "sizing_criterion": {"key": "sizingCriterion", "type": "str"}, + "confidence_rating_in_percentage": {"key": "confidenceRatingInPercentage", "type": "float"}, + "prices_timestamp": {"key": "pricesTimestamp", "type": "iso-8601"}, + "created_timestamp": {"key": "createdTimestamp", "type": "iso-8601"}, + "updated_timestamp": {"key": "updatedTimestamp", "type": "iso-8601"}, + "status": {"key": "status", "type": "str"}, + "schema_version": {"key": "schemaVersion", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, + os_license: Optional[Union[str, "_models.OsLicense"]] = None, + environment_type: Optional[Union[str, "_models.EnvironmentType"]] = None, + entity_uptime: Optional["_models.EntityUptime"] = None, + optimization_logic: Optional[Union[str, "_models.OptimizationLogic"]] = None, + reserved_instance_for_vm: Optional[Union[str, "_models.AzureReservedInstance"]] = None, + azure_offer_code_for_vm: Optional[Union[str, "_models.AzureOfferCode"]] = None, + ea_subscription_id: Optional[str] = None, + azure_sql_managed_instance_settings: Optional["_models.SqlMiSettings"] = None, + azure_sql_database_settings: Optional["_models.SqlDbSettings"] = None, + azure_sql_vm_settings: Optional["_models.SqlVmSettings"] = None, + multi_subnet_intent: Optional[Union[str, "_models.MultiSubnetIntent"]] = None, + async_commit_mode_intent: Optional[Union[str, "_models.AsyncCommitModeIntent"]] = None, + is_internet_access_available: Optional[bool] = None, + disaster_recovery_location: Optional[Union[str, "_models.AzureLocation"]] = None, + enable_hadr_assessment: Optional[bool] = None, + azure_security_offering_type: Optional[Union[str, "_models.AzureSecurityOfferingType"]] = None, + reserved_instance: Optional[Union[str, "_models.AzureReservedInstance"]] = None, + sql_server_license: Optional[Union[str, "_models.SqlServerLicense"]] = None, + group_type: Optional[Union[str, "_models.GroupType"]] = None, + assessment_type: Optional[Union[str, "_models.AssessmentType"]] = None, + azure_location: Optional[str] = None, + azure_offer_code: Optional[Union[str, "_models.AzureOfferCode"]] = None, + currency: Optional[Union[str, "_models.AzureCurrency"]] = None, + scaling_factor: Optional[float] = None, + percentile: Optional[Union[str, "_models.Percentile"]] = None, + time_range: Optional[Union[str, "_models.TimeRange"]] = None, + perf_data_start_time: Optional[datetime.datetime] = None, + perf_data_end_time: Optional[datetime.datetime] = None, + discount_percentage: Optional[float] = None, + sizing_criterion: Optional[Union[str, "_models.AssessmentSizingCriterion"]] = None, + confidence_rating_in_percentage: Optional[float] = None, + **kwargs: Any + ) -> None: + """ + :keyword provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :paramtype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningState + :keyword os_license: Gets or sets user configurable setting to display the azure hybrid use + benefit. Known values are: "Unknown", "Yes", and "No". + :paramtype os_license: str or ~azure.mgmt.migrationassessment.models.OsLicense + :keyword environment_type: Gets or sets user configurable setting to display the environment + type. Known values are: "Production" and "Test". + :paramtype environment_type: str or ~azure.mgmt.migrationassessment.models.EnvironmentType + :keyword entity_uptime: Gets or sets the duration for which the entity (SQL, VMs) are up in the + on-premises environment. + :paramtype entity_uptime: ~azure.mgmt.migrationassessment.models.EntityUptime + :keyword optimization_logic: Gets or sets SQL optimization logic. Known values are: + "MinimizeCost", "ModernizeToPaaS", "ModernizeToAzureSqlMi", and "ModernizeToAzureSqlDb". + :paramtype optimization_logic: str or ~azure.mgmt.migrationassessment.models.OptimizationLogic + :keyword reserved_instance_for_vm: Gets or sets azure reserved instance for VM. Known values + are: "None", "RI1Year", and "RI3Year". + :paramtype reserved_instance_for_vm: str or + ~azure.mgmt.migrationassessment.models.AzureReservedInstance + :keyword azure_offer_code_for_vm: Gets or sets Azure Offer Code for VM. Known values are: + "Unknown", "MSAZR0003P", "MSAZR0044P", "MSAZR0059P", "MSAZR0060P", "MSAZR0062P", "MSAZR0063P", + "MSAZR0064P", "MSAZR0029P", "MSAZR0022P", "MSAZR0023P", "MSAZR0148P", "MSAZR0025P", + "MSAZR0036P", "MSAZR0120P", "MSAZR0121P", "MSAZR0122P", "MSAZR0123P", "MSAZR0124P", + "MSAZR0125P", "MSAZR0126P", "MSAZR0127P", "MSAZR0128P", "MSAZR0129P", "MSAZR0130P", + "MSAZR0111P", "MSAZR0144P", "MSAZR0149P", "MSMCAZR0044P", "MSMCAZR0059P", "MSMCAZR0060P", + "MSMCAZR0063P", "MSMCAZR0120P", "MSMCAZR0121P", "MSMCAZR0125P", "MSMCAZR0128P", "MSAZRDE0003P", + "MSAZRDE0044P", "MSAZRUSGOV0003P", "EA", "MSAZR0243P", "SavingsPlan1Year", and + "SavingsPlan3Year". + :paramtype azure_offer_code_for_vm: str or + ~azure.mgmt.migrationassessment.models.AzureOfferCode + :keyword ea_subscription_id: Gets or sets the Enterprise agreement subscription id. + :paramtype ea_subscription_id: str + :keyword azure_sql_managed_instance_settings: Gets or sets user configurable SQL managed + instance settings. + :paramtype azure_sql_managed_instance_settings: + ~azure.mgmt.migrationassessment.models.SqlMiSettings + :keyword azure_sql_database_settings: Gets or sets user configurable SQL database settings. + :paramtype azure_sql_database_settings: ~azure.mgmt.migrationassessment.models.SqlDbSettings + :keyword azure_sql_vm_settings: Gets or sets user configurable SQL VM settings. + :paramtype azure_sql_vm_settings: ~azure.mgmt.migrationassessment.models.SqlVmSettings + :keyword multi_subnet_intent: Gets or sets user preference indicating intent of multi-subnet + configuration. Known values are: "None", "HighAvailability", and "DisasterRecovery". + :paramtype multi_subnet_intent: str or ~azure.mgmt.migrationassessment.models.MultiSubnetIntent + :keyword async_commit_mode_intent: Gets or sets user preference indicating intent of async + commit mode. Known values are: "None", "HighAvailability", and "DisasterRecovery". + :paramtype async_commit_mode_intent: str or + ~azure.mgmt.migrationassessment.models.AsyncCommitModeIntent + :keyword is_internet_access_available: Gets or sets a value indicating whether internet access + is available. + :paramtype is_internet_access_available: bool + :keyword disaster_recovery_location: Gets or sets the Azure Location or Azure region where to + which the machines + will be migrated. Known values are: "Unknown", "EastAsia", "SoutheastAsia", "AustraliaEast", + "AustraliaSoutheast", "BrazilSouth", "CanadaCentral", "CanadaEast", "WestEurope", + "NorthEurope", "CentralIndia", "SouthIndia", "WestIndia", "JapanEast", "JapanWest", + "KoreaCentral", "KoreaSouth", "UkWest", "UkSouth", "NorthCentralUs", "EastUs", "WestUs2", + "SouthCentralUs", "CentralUs", "EastUs2", "WestUs", "WestCentralUs", "GermanyCentral", + "GermanyNortheast", "ChinaNorth", "ChinaEast", "USGovArizona", "USGovTexas", "USGovIowa", + "USGovVirginia", "USDoDCentral", "USDoDEast", "FranceCentral", "AustraliaCentral", + "SouthAfricaNorth", "FranceSouth", "AustraliaCentral2", "SouthAfricaWest", "GermanyNorth", + "GermanyWestCentral", "NorwayEast", "NorwayWest", "ChinaEast2", "ChinaNorth2", + "SwitzerlandNorth", "SwitzerlandWest", "UAENorth", "UAECentral", "UsNatEast", "UsNatWest", + "UsSecEast", "UsSecCentral", "UsSecWest", "SwedenCentral", and "QatarCentral". + :paramtype disaster_recovery_location: str or + ~azure.mgmt.migrationassessment.models.AzureLocation + :keyword enable_hadr_assessment: Gets or sets a value indicating whether HADR assessments needs + to be created. + :paramtype enable_hadr_assessment: bool + :keyword azure_security_offering_type: Gets or sets a value indicating azure security offering + type. Known values are: "NO" and "MDC". + :paramtype azure_security_offering_type: str or + ~azure.mgmt.migrationassessment.models.AzureSecurityOfferingType + :keyword reserved_instance: Reserved instance. Known values are: "None", "RI1Year", and + "RI3Year". + :paramtype reserved_instance: str or + ~azure.mgmt.migrationassessment.models.AzureReservedInstance + :keyword sql_server_license: SQL server license. Known values are: "Unknown", "Yes", and "No". + :paramtype sql_server_license: str or ~azure.mgmt.migrationassessment.models.SqlServerLicense + :keyword group_type: Gets the group type for the assessment. Known values are: "Default", + "Import", and "Import". + :paramtype group_type: str or ~azure.mgmt.migrationassessment.models.GroupType + :keyword assessment_type: Assessment type of the assessment. Known values are: "Unknown", + "MachineAssessment", "AvsAssessment", "SqlAssessment", and "WebAppAssessment". + :paramtype assessment_type: str or ~azure.mgmt.migrationassessment.models.AssessmentType + :keyword azure_location: Azure Location or Azure region where to which the machines will be + migrated. + :paramtype azure_location: str + :keyword azure_offer_code: Azure Offer Code. Known values are: "Unknown", "MSAZR0003P", + "MSAZR0044P", "MSAZR0059P", "MSAZR0060P", "MSAZR0062P", "MSAZR0063P", "MSAZR0064P", + "MSAZR0029P", "MSAZR0022P", "MSAZR0023P", "MSAZR0148P", "MSAZR0025P", "MSAZR0036P", + "MSAZR0120P", "MSAZR0121P", "MSAZR0122P", "MSAZR0123P", "MSAZR0124P", "MSAZR0125P", + "MSAZR0126P", "MSAZR0127P", "MSAZR0128P", "MSAZR0129P", "MSAZR0130P", "MSAZR0111P", + "MSAZR0144P", "MSAZR0149P", "MSMCAZR0044P", "MSMCAZR0059P", "MSMCAZR0060P", "MSMCAZR0063P", + "MSMCAZR0120P", "MSMCAZR0121P", "MSMCAZR0125P", "MSMCAZR0128P", "MSAZRDE0003P", "MSAZRDE0044P", + "MSAZRUSGOV0003P", "EA", "MSAZR0243P", "SavingsPlan1Year", and "SavingsPlan3Year". + :paramtype azure_offer_code: str or ~azure.mgmt.migrationassessment.models.AzureOfferCode + :keyword currency: Currency in which prices should be reported. Known values are: "Unknown", + "USD", "DKK", "CAD", "IDR", "JPY", "KRW", "NZD", "NOK", "RUB", "SAR", "ZAR", "SEK", "TRY", + "GBP", "MXN", "MYR", "INR", "HKD", "BRL", "TWD", "EUR", "CHF", "ARS", "AUD", "CNY", and "TRY". + :paramtype currency: str or ~azure.mgmt.migrationassessment.models.AzureCurrency + :keyword scaling_factor: Percentage of buffer that user wants on performance metrics when + recommending + Azure sizes. + :paramtype scaling_factor: float + :keyword percentile: Percentile of the utilization data values to be considered while assessing + machines. Known values are: "Percentile50", "Percentile90", "Percentile95", and + "Percentile99". + :paramtype percentile: str or ~azure.mgmt.migrationassessment.models.Percentile + :keyword time_range: Time Range for which the historic utilization data should be considered + for + assessment. Known values are: "Day", "Week", "Month", and "Custom". + :paramtype time_range: str or ~azure.mgmt.migrationassessment.models.TimeRange + :keyword perf_data_start_time: Gets or sets the start time to consider performance data for + assessment. + :paramtype perf_data_start_time: ~datetime.datetime + :keyword perf_data_end_time: Gets or sets the end time to consider performance data for + assessment. + :paramtype perf_data_end_time: ~datetime.datetime + :keyword discount_percentage: Custom discount percentage. + :paramtype discount_percentage: float + :keyword sizing_criterion: Assessment sizing criterion. Known values are: "PerformanceBased" + and "AsOnPremises". + :paramtype sizing_criterion: str or + ~azure.mgmt.migrationassessment.models.AssessmentSizingCriterion + :keyword confidence_rating_in_percentage: Confidence Rating in Percentage. + :paramtype confidence_rating_in_percentage: float + """ + super().__init__(provisioning_state=provisioning_state, **kwargs) + self.os_license = os_license + self.environment_type = environment_type + self.entity_uptime = entity_uptime + self.optimization_logic = optimization_logic + self.reserved_instance_for_vm = reserved_instance_for_vm + self.azure_offer_code_for_vm = azure_offer_code_for_vm + self.ea_subscription_id = ea_subscription_id + self.azure_sql_managed_instance_settings = azure_sql_managed_instance_settings + self.azure_sql_database_settings = azure_sql_database_settings + self.azure_sql_vm_settings = azure_sql_vm_settings + self.multi_subnet_intent = multi_subnet_intent + self.async_commit_mode_intent = async_commit_mode_intent + self.is_internet_access_available = is_internet_access_available + self.disaster_recovery_location = disaster_recovery_location + self.enable_hadr_assessment = enable_hadr_assessment + self.azure_security_offering_type = azure_security_offering_type + self.reserved_instance = reserved_instance + self.sql_server_license = sql_server_license + self.group_type = group_type + self.assessment_type = assessment_type + self.azure_location = azure_location + self.azure_offer_code = azure_offer_code + self.currency = currency + self.scaling_factor = scaling_factor + self.percentile = percentile + self.time_range = time_range + self.perf_data_start_time = perf_data_start_time + self.perf_data_end_time = perf_data_end_time + self.stage = None + self.discount_percentage = discount_percentage + self.sizing_criterion = sizing_criterion + self.confidence_rating_in_percentage = confidence_rating_in_percentage + self.prices_timestamp = None + self.created_timestamp = None + self.updated_timestamp = None + self.status = None + self.schema_version = None + + +class SqlAssessmentV2Summary(ProxyResource): + """SQL Assessment REST 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.SqlAssessmentV2SummaryProperties + """ + + _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": "SqlAssessmentV2SummaryProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.SqlAssessmentV2SummaryProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.SqlAssessmentV2SummaryProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class SqlAssessmentV2SummaryData(_serialization.Model): + """SQL Assessment V2 summary data. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar suitability_summary: Sql assessment summary data. + :vartype suitability_summary: dict[str, int] + :ivar monthly_compute_cost: Monthly compute cost. + :vartype monthly_compute_cost: float + :ivar monthly_storage_cost: Monthly storage cost. + :vartype monthly_storage_cost: float + :ivar monthly_license_cost: Monthly license cost. + :vartype monthly_license_cost: float + :ivar confidence_score: Confidence Rating. + :vartype confidence_score: float + :ivar monthly_security_cost: Monthly security cost. + :vartype monthly_security_cost: float + """ + + _validation = { + "suitability_summary": {"readonly": True}, + "monthly_compute_cost": {"readonly": True}, + "monthly_storage_cost": {"readonly": True}, + "monthly_license_cost": {"readonly": True}, + "confidence_score": {"readonly": True}, + "monthly_security_cost": {"readonly": True}, + } + + _attribute_map = { + "suitability_summary": {"key": "suitabilitySummary", "type": "{int}"}, + "monthly_compute_cost": {"key": "monthlyComputeCost", "type": "float"}, + "monthly_storage_cost": {"key": "monthlyStorageCost", "type": "float"}, + "monthly_license_cost": {"key": "monthlyLicenseCost", "type": "float"}, + "confidence_score": {"key": "confidenceScore", "type": "float"}, + "monthly_security_cost": {"key": "monthlySecurityCost", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.suitability_summary = None + self.monthly_compute_cost = None + self.monthly_storage_cost = None + self.monthly_license_cost = None + self.confidence_score = None + self.monthly_security_cost = None + + +class SqlAssessmentV2SummaryListResult(_serialization.Model): + """The response of a SqlAssessmentV2Summary list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The SqlAssessmentV2Summary items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.SqlAssessmentV2Summary] + :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": "[SqlAssessmentV2Summary]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.SqlAssessmentV2Summary"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The SqlAssessmentV2Summary items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.SqlAssessmentV2Summary] + :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 SqlAssessmentV2SummaryProperties(_serialization.Model): + """SQL Assessment V2 summary properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar assessment_summary: Gets or sets the Assessment summary. + :vartype assessment_summary: dict[str, + ~azure.mgmt.migrationassessment.models.SqlAssessmentV2SummaryData] + :ivar distribution_by_support_status: Gets the distribution of sqlInstances by support status. + :vartype distribution_by_support_status: dict[str, int] + :ivar distribution_by_service_pack_insight: Gets the distribution distribution of sqlInstances + by service pack insight. + :vartype distribution_by_service_pack_insight: dict[str, int] + :ivar distribution_by_sql_version: Gets the distribution of sqlInstances by sql version. + :vartype distribution_by_sql_version: dict[str, int] + :ivar distribution_by_sql_edition: Gets the distribution of sqlInstances by sql edition. + :vartype distribution_by_sql_edition: dict[str, int] + :ivar instance_distribution_by_sizing_criterion: Gets the instance distribution by sizing + criterion. + :vartype instance_distribution_by_sizing_criterion: dict[str, int] + :ivar database_distribution_by_sizing_criterion: Gets the database distribution by sizing + criterion. + :vartype database_distribution_by_sizing_criterion: dict[str, int] + :ivar number_of_machines: Number of machines part of the assessment. + :vartype number_of_machines: int + :ivar number_of_sql_instances: Number of sql instances part of the assessment. + :vartype number_of_sql_instances: int + :ivar number_of_successfully_discovered_sql_instances: Number of successfully discovered sql + instances part of the assessment. + :vartype number_of_successfully_discovered_sql_instances: int + :ivar number_of_sql_databases: Number of sql databases part of the assessment. + :vartype number_of_sql_databases: int + :ivar number_of_fci_instances: Number of sql failover cluster instances part of the assessment. + :vartype number_of_fci_instances: int + :ivar number_of_sql_availability_groups: Number of sql availability groups part of the + assessment. + :vartype number_of_sql_availability_groups: int + """ + + _validation = { + "assessment_summary": {"readonly": True}, + "distribution_by_support_status": {"readonly": True}, + "distribution_by_service_pack_insight": {"readonly": True}, + "distribution_by_sql_version": {"readonly": True}, + "distribution_by_sql_edition": {"readonly": True}, + "instance_distribution_by_sizing_criterion": {"readonly": True}, + "database_distribution_by_sizing_criterion": {"readonly": True}, + "number_of_machines": {"readonly": True}, + "number_of_sql_instances": {"readonly": True}, + "number_of_successfully_discovered_sql_instances": {"readonly": True}, + "number_of_sql_databases": {"readonly": True}, + "number_of_fci_instances": {"readonly": True}, + "number_of_sql_availability_groups": {"readonly": True}, + } + + _attribute_map = { + "assessment_summary": {"key": "assessmentSummary", "type": "{SqlAssessmentV2SummaryData}"}, + "distribution_by_support_status": {"key": "distributionBySupportStatus", "type": "{int}"}, + "distribution_by_service_pack_insight": {"key": "distributionByServicePackInsight", "type": "{int}"}, + "distribution_by_sql_version": {"key": "distributionBySqlVersion", "type": "{int}"}, + "distribution_by_sql_edition": {"key": "distributionBySqlEdition", "type": "{int}"}, + "instance_distribution_by_sizing_criterion": {"key": "instanceDistributionBySizingCriterion", "type": "{int}"}, + "database_distribution_by_sizing_criterion": {"key": "databaseDistributionBySizingCriterion", "type": "{int}"}, + "number_of_machines": {"key": "numberOfMachines", "type": "int"}, + "number_of_sql_instances": {"key": "numberOfSqlInstances", "type": "int"}, + "number_of_successfully_discovered_sql_instances": { + "key": "numberOfSuccessfullyDiscoveredSqlInstances", + "type": "int", + }, + "number_of_sql_databases": {"key": "numberOfSqlDatabases", "type": "int"}, + "number_of_fci_instances": {"key": "numberOfFciInstances", "type": "int"}, + "number_of_sql_availability_groups": {"key": "numberOfSqlAvailabilityGroups", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.assessment_summary = None + self.distribution_by_support_status = None + self.distribution_by_service_pack_insight = None + self.distribution_by_sql_version = None + self.distribution_by_sql_edition = None + self.instance_distribution_by_sizing_criterion = None + self.database_distribution_by_sizing_criterion = None + self.number_of_machines = None + self.number_of_sql_instances = None + self.number_of_successfully_discovered_sql_instances = None + self.number_of_sql_databases = None + self.number_of_fci_instances = None + self.number_of_sql_availability_groups = None + + +class SqlAvailabilityGroupDataOverview(_serialization.Model): + """Assessed Sql Availability Group Data Overview. + + :ivar availability_group_id: Gets the availability group id. + :vartype availability_group_id: str + :ivar availability_group_name: Gets the availability group name. + :vartype availability_group_name: str + :ivar sql_availability_group_sds_arm_id: Gets the availability group arm id. + :vartype sql_availability_group_sds_arm_id: str + :ivar sql_availability_group_entity_id: Gets the availability group entity id. + :vartype sql_availability_group_entity_id: str + :ivar sql_availability_replica_id: Gets the availability replica id. + :vartype sql_availability_replica_id: str + """ + + _attribute_map = { + "availability_group_id": {"key": "availabilityGroupId", "type": "str"}, + "availability_group_name": {"key": "availabilityGroupName", "type": "str"}, + "sql_availability_group_sds_arm_id": {"key": "sqlAvailabilityGroupSdsArmId", "type": "str"}, + "sql_availability_group_entity_id": {"key": "sqlAvailabilityGroupEntityId", "type": "str"}, + "sql_availability_replica_id": {"key": "sqlAvailabilityReplicaId", "type": "str"}, + } + + def __init__( + self, + *, + availability_group_id: Optional[str] = None, + availability_group_name: Optional[str] = None, + sql_availability_group_sds_arm_id: Optional[str] = None, + sql_availability_group_entity_id: Optional[str] = None, + sql_availability_replica_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword availability_group_id: Gets the availability group id. + :paramtype availability_group_id: str + :keyword availability_group_name: Gets the availability group name. + :paramtype availability_group_name: str + :keyword sql_availability_group_sds_arm_id: Gets the availability group arm id. + :paramtype sql_availability_group_sds_arm_id: str + :keyword sql_availability_group_entity_id: Gets the availability group entity id. + :paramtype sql_availability_group_entity_id: str + :keyword sql_availability_replica_id: Gets the availability replica id. + :paramtype sql_availability_replica_id: str + """ + super().__init__(**kwargs) + self.availability_group_id = availability_group_id + self.availability_group_name = availability_group_name + self.sql_availability_group_sds_arm_id = sql_availability_group_sds_arm_id + self.sql_availability_group_entity_id = sql_availability_group_entity_id + self.sql_availability_replica_id = sql_availability_replica_id + + +class SqlAvailabilityReplicaSummary(_serialization.Model): + """Assessed Sql Availability Replica Summary. + + :ivar number_of_synchronous_read_replicas: Gets the number Of synchronous read replicas. + :vartype number_of_synchronous_read_replicas: int + :ivar number_of_synchronous_non_read_replicas: Gets the number Of synchronous non read + replicas. + :vartype number_of_synchronous_non_read_replicas: int + :ivar number_of_asynchronous_read_replicas: Gets the number Of asynchronous read replicas. + :vartype number_of_asynchronous_read_replicas: int + :ivar number_of_asynchronous_non_read_replicas: Gets the number Of asynchronous non read + replicas. + :vartype number_of_asynchronous_non_read_replicas: int + :ivar number_of_primary_replicas: Gets the number Of primary replicas. + :vartype number_of_primary_replicas: int + """ + + _attribute_map = { + "number_of_synchronous_read_replicas": {"key": "numberOfSynchronousReadReplicas", "type": "int"}, + "number_of_synchronous_non_read_replicas": {"key": "numberOfSynchronousNonReadReplicas", "type": "int"}, + "number_of_asynchronous_read_replicas": {"key": "numberOfAsynchronousReadReplicas", "type": "int"}, + "number_of_asynchronous_non_read_replicas": {"key": "numberOfAsynchronousNonReadReplicas", "type": "int"}, + "number_of_primary_replicas": {"key": "numberOfPrimaryReplicas", "type": "int"}, + } + + def __init__( + self, + *, + number_of_synchronous_read_replicas: Optional[int] = None, + number_of_synchronous_non_read_replicas: Optional[int] = None, + number_of_asynchronous_read_replicas: Optional[int] = None, + number_of_asynchronous_non_read_replicas: Optional[int] = None, + number_of_primary_replicas: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword number_of_synchronous_read_replicas: Gets the number Of synchronous read replicas. + :paramtype number_of_synchronous_read_replicas: int + :keyword number_of_synchronous_non_read_replicas: Gets the number Of synchronous non read + replicas. + :paramtype number_of_synchronous_non_read_replicas: int + :keyword number_of_asynchronous_read_replicas: Gets the number Of asynchronous read replicas. + :paramtype number_of_asynchronous_read_replicas: int + :keyword number_of_asynchronous_non_read_replicas: Gets the number Of asynchronous non read + replicas. + :paramtype number_of_asynchronous_non_read_replicas: int + :keyword number_of_primary_replicas: Gets the number Of primary replicas. + :paramtype number_of_primary_replicas: int + """ + super().__init__(**kwargs) + self.number_of_synchronous_read_replicas = number_of_synchronous_read_replicas + self.number_of_synchronous_non_read_replicas = number_of_synchronous_non_read_replicas + self.number_of_asynchronous_read_replicas = number_of_asynchronous_read_replicas + self.number_of_asynchronous_non_read_replicas = number_of_asynchronous_non_read_replicas + self.number_of_primary_replicas = number_of_primary_replicas + + +class SqlCollector(ProxyResource): + """The SQL collector REST object. + + 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.CollectorPropertiesBaseWithAgent + """ + + _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": "CollectorPropertiesBaseWithAgent"}, + } + + def __init__( + self, *, properties: Optional["_models.CollectorPropertiesBaseWithAgent"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.CollectorPropertiesBaseWithAgent + """ + super().__init__(**kwargs) + self.properties = properties + + +class SqlCollectorListResult(_serialization.Model): + """The response of a SqlCollector list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The SqlCollector items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.SqlCollector] + :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": "[SqlCollector]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.SqlCollector"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The SqlCollector items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.SqlCollector] + :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 SqlDbSettings(_serialization.Model): + """SQL database assessment settings. + + :ivar azure_sql_service_tier: Gets or sets the azure SQL service tier. Known values are: + "Unknown", "Automatic", "GeneralPurpose", "BusinessCritical", and "HyperScale". + :vartype azure_sql_service_tier: str or + ~azure.mgmt.migrationassessment.models.AzureSqlServiceTier + :ivar azure_sql_data_base_type: Gets or sets the azure PAAS SQL instance type. Known values + are: "Unknown", "Automatic", "SingleDatabase", and "ElasticPool". + :vartype azure_sql_data_base_type: str or + ~azure.mgmt.migrationassessment.models.AzureSqlDataBaseType + :ivar azure_sql_compute_tier: Gets or sets the azure SQL compute tier. Known values are: + "Unknown", "Automatic", "Provisioned", and "Serverless". + :vartype azure_sql_compute_tier: str or ~azure.mgmt.migrationassessment.models.ComputeTier + :ivar azure_sql_purchase_model: Gets or sets the azure SQL purchase model. Known values are: + "Unknown", "VCore", and "DTU". + :vartype azure_sql_purchase_model: str or + ~azure.mgmt.migrationassessment.models.AzureSqlPurchaseModel + """ + + _attribute_map = { + "azure_sql_service_tier": {"key": "azureSqlServiceTier", "type": "str"}, + "azure_sql_data_base_type": {"key": "azureSqlDataBaseType", "type": "str"}, + "azure_sql_compute_tier": {"key": "azureSqlComputeTier", "type": "str"}, + "azure_sql_purchase_model": {"key": "azureSqlPurchaseModel", "type": "str"}, + } + + def __init__( + self, + *, + azure_sql_service_tier: Optional[Union[str, "_models.AzureSqlServiceTier"]] = None, + azure_sql_data_base_type: Optional[Union[str, "_models.AzureSqlDataBaseType"]] = None, + azure_sql_compute_tier: Optional[Union[str, "_models.ComputeTier"]] = None, + azure_sql_purchase_model: Optional[Union[str, "_models.AzureSqlPurchaseModel"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword azure_sql_service_tier: Gets or sets the azure SQL service tier. Known values are: + "Unknown", "Automatic", "GeneralPurpose", "BusinessCritical", and "HyperScale". + :paramtype azure_sql_service_tier: str or + ~azure.mgmt.migrationassessment.models.AzureSqlServiceTier + :keyword azure_sql_data_base_type: Gets or sets the azure PAAS SQL instance type. Known values + are: "Unknown", "Automatic", "SingleDatabase", and "ElasticPool". + :paramtype azure_sql_data_base_type: str or + ~azure.mgmt.migrationassessment.models.AzureSqlDataBaseType + :keyword azure_sql_compute_tier: Gets or sets the azure SQL compute tier. Known values are: + "Unknown", "Automatic", "Provisioned", and "Serverless". + :paramtype azure_sql_compute_tier: str or ~azure.mgmt.migrationassessment.models.ComputeTier + :keyword azure_sql_purchase_model: Gets or sets the azure SQL purchase model. Known values are: + "Unknown", "VCore", and "DTU". + :paramtype azure_sql_purchase_model: str or + ~azure.mgmt.migrationassessment.models.AzureSqlPurchaseModel + """ + super().__init__(**kwargs) + self.azure_sql_service_tier = azure_sql_service_tier + self.azure_sql_data_base_type = azure_sql_data_base_type + self.azure_sql_compute_tier = azure_sql_compute_tier + self.azure_sql_purchase_model = azure_sql_purchase_model + + +class SqlFCIMetadata(_serialization.Model): + """Sql fci meta data. + + :ivar state: Gets the Sql fci meta data state. Known values are: "Unknown", "Inherited", + "Initializing", "Online", "Offline", "Failed", "Pending", "OnlinePending", and + "OfflinePending". + :vartype state: str or ~azure.mgmt.migrationassessment.models.SqlFCIMetadataState + :ivar is_multi_subnet: Gets whether fci is multi subnet. + :vartype is_multi_subnet: bool + :ivar fci_shared_disk_count: Gets the fci shared disk count. + :vartype fci_shared_disk_count: int + """ + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + "is_multi_subnet": {"key": "isMultiSubnet", "type": "bool"}, + "fci_shared_disk_count": {"key": "fciSharedDiskCount", "type": "int"}, + } + + def __init__( + self, + *, + state: Optional[Union[str, "_models.SqlFCIMetadataState"]] = None, + is_multi_subnet: Optional[bool] = None, + fci_shared_disk_count: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword state: Gets the Sql fci meta data state. Known values are: "Unknown", "Inherited", + "Initializing", "Online", "Offline", "Failed", "Pending", "OnlinePending", and + "OfflinePending". + :paramtype state: str or ~azure.mgmt.migrationassessment.models.SqlFCIMetadataState + :keyword is_multi_subnet: Gets whether fci is multi subnet. + :paramtype is_multi_subnet: bool + :keyword fci_shared_disk_count: Gets the fci shared disk count. + :paramtype fci_shared_disk_count: int + """ + super().__init__(**kwargs) + self.state = state + self.is_multi_subnet = is_multi_subnet + self.fci_shared_disk_count = fci_shared_disk_count + + +class SqlMigrationGuideline(_serialization.Model): + """Sql Migration Guideline. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar guideline_id: Gets the guideline id. + :vartype guideline_id: str + :ivar migration_guideline_category: Gets the migration guideline category. Known values are: + "Unknown", "General", "FailoverCluterInstanceGuideLine", and "AvailabilityGroupGuideline". + :vartype migration_guideline_category: str or + ~azure.mgmt.migrationassessment.models.SqlMigrationGuidelineCategory + :ivar migration_guideline_context: Gets the migration guideline context. + :vartype migration_guideline_context: + list[~azure.mgmt.migrationassessment.models.MigrationGuidelineContext] + """ + + _validation = { + "migration_guideline_context": {"readonly": True}, + } + + _attribute_map = { + "guideline_id": {"key": "guidelineId", "type": "str"}, + "migration_guideline_category": {"key": "migrationGuidelineCategory", "type": "str"}, + "migration_guideline_context": {"key": "migrationGuidelineContext", "type": "[MigrationGuidelineContext]"}, + } + + def __init__( + self, + *, + guideline_id: Optional[str] = None, + migration_guideline_category: Optional[Union[str, "_models.SqlMigrationGuidelineCategory"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword guideline_id: Gets the guideline id. + :paramtype guideline_id: str + :keyword migration_guideline_category: Gets the migration guideline category. Known values are: + "Unknown", "General", "FailoverCluterInstanceGuideLine", and "AvailabilityGroupGuideline". + :paramtype migration_guideline_category: str or + ~azure.mgmt.migrationassessment.models.SqlMigrationGuidelineCategory + """ + super().__init__(**kwargs) + self.guideline_id = guideline_id + self.migration_guideline_category = migration_guideline_category + self.migration_guideline_context = None + + +class SqlMiSettings(_serialization.Model): + """SQL managed instance assessment settings. + + :ivar azure_sql_service_tier: Gets or sets the azure SQL service tier. Known values are: + "Unknown", "Automatic", "GeneralPurpose", "BusinessCritical", and "HyperScale". + :vartype azure_sql_service_tier: str or + ~azure.mgmt.migrationassessment.models.AzureSqlServiceTier + :ivar azure_sql_instance_type: Gets or sets the azure PAAS SQL instance type. Known values are: + "Unknown", "Automatic", "SingleInstance", and "InstancePools". + :vartype azure_sql_instance_type: str or + ~azure.mgmt.migrationassessment.models.AzureSqlInstanceType + """ + + _attribute_map = { + "azure_sql_service_tier": {"key": "azureSqlServiceTier", "type": "str"}, + "azure_sql_instance_type": {"key": "azureSqlInstanceType", "type": "str"}, + } + + def __init__( + self, + *, + azure_sql_service_tier: Optional[Union[str, "_models.AzureSqlServiceTier"]] = None, + azure_sql_instance_type: Optional[Union[str, "_models.AzureSqlInstanceType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword azure_sql_service_tier: Gets or sets the azure SQL service tier. Known values are: + "Unknown", "Automatic", "GeneralPurpose", "BusinessCritical", and "HyperScale". + :paramtype azure_sql_service_tier: str or + ~azure.mgmt.migrationassessment.models.AzureSqlServiceTier + :keyword azure_sql_instance_type: Gets or sets the azure PAAS SQL instance type. Known values + are: "Unknown", "Automatic", "SingleInstance", and "InstancePools". + :paramtype azure_sql_instance_type: str or + ~azure.mgmt.migrationassessment.models.AzureSqlInstanceType + """ + super().__init__(**kwargs) + self.azure_sql_service_tier = azure_sql_service_tier + self.azure_sql_instance_type = azure_sql_instance_type + + +class SqlPaaSTargetOptions(_serialization.Model): + """SQL target options. + + :ivar compute_tier: Gets or sets the Azure SQL compute tier. Known values are: "Unknown", + "Automatic", "Provisioned", and "Serverless". + :vartype compute_tier: str or ~azure.mgmt.migrationassessment.models.ComputeTier + :ivar hardware_generation: Gets or sets the Azure SQL hardware generation. Known values are: + "Unknown", "Automatic", "Gen5", "Fsv2_series", "M_series", and "DC_series". + :vartype hardware_generation: str or ~azure.mgmt.migrationassessment.models.HardwareGeneration + :ivar target_type: Gets or sets the Azure SQL target type. Known values are: "Unknown", + "Recommended", "AzureSqlDatabase", "AzureSqlManagedInstance", "AzureSqlVirtualMachine", and + "AzureVirtualMachine". + :vartype target_type: str or ~azure.mgmt.migrationassessment.models.TargetType + :ivar service_tier: Gets or sets the Azure SQL service tier. Known values are: "Unknown", + "Automatic", "GeneralPurpose", "BusinessCritical", and "HyperScale". + :vartype service_tier: str or ~azure.mgmt.migrationassessment.models.AzureSqlServiceTier + :ivar target_locations: Gets or sets the target location. + :vartype target_locations: list[str or ~azure.mgmt.migrationassessment.models.AzureLocation] + """ + + _attribute_map = { + "compute_tier": {"key": "computeTier", "type": "str"}, + "hardware_generation": {"key": "hardwareGeneration", "type": "str"}, + "target_type": {"key": "targetType", "type": "str"}, + "service_tier": {"key": "serviceTier", "type": "str"}, + "target_locations": {"key": "targetLocations", "type": "[str]"}, + } + + def __init__( + self, + *, + compute_tier: Optional[Union[str, "_models.ComputeTier"]] = None, + hardware_generation: Optional[Union[str, "_models.HardwareGeneration"]] = None, + target_type: Optional[Union[str, "_models.TargetType"]] = None, + service_tier: Optional[Union[str, "_models.AzureSqlServiceTier"]] = None, + target_locations: Optional[List[Union[str, "_models.AzureLocation"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword compute_tier: Gets or sets the Azure SQL compute tier. Known values are: "Unknown", + "Automatic", "Provisioned", and "Serverless". + :paramtype compute_tier: str or ~azure.mgmt.migrationassessment.models.ComputeTier + :keyword hardware_generation: Gets or sets the Azure SQL hardware generation. Known values are: + "Unknown", "Automatic", "Gen5", "Fsv2_series", "M_series", and "DC_series". + :paramtype hardware_generation: str or + ~azure.mgmt.migrationassessment.models.HardwareGeneration + :keyword target_type: Gets or sets the Azure SQL target type. Known values are: "Unknown", + "Recommended", "AzureSqlDatabase", "AzureSqlManagedInstance", "AzureSqlVirtualMachine", and + "AzureVirtualMachine". + :paramtype target_type: str or ~azure.mgmt.migrationassessment.models.TargetType + :keyword service_tier: Gets or sets the Azure SQL service tier. Known values are: "Unknown", + "Automatic", "GeneralPurpose", "BusinessCritical", and "HyperScale". + :paramtype service_tier: str or ~azure.mgmt.migrationassessment.models.AzureSqlServiceTier + :keyword target_locations: Gets or sets the target location. + :paramtype target_locations: list[str or ~azure.mgmt.migrationassessment.models.AzureLocation] + """ + super().__init__(**kwargs) + self.compute_tier = compute_tier + self.hardware_generation = hardware_generation + self.target_type = target_type + self.service_tier = service_tier + self.target_locations = target_locations + + +class SqlRecommendationReasoning(_serialization.Model): + """Class representing Azure SQL Recommendation Reasoning. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar reasoning_id: Gets the reasoning id. + :vartype reasoning_id: str + :ivar reasoning_string: Gets the reasoning status. + :vartype reasoning_string: str + :ivar reasoning_category: Gets the reasoning category. + :vartype reasoning_category: str + :ivar context_parameters: Gets the Sql recommended reasoning parameters. + :vartype context_parameters: + list[~azure.mgmt.migrationassessment.models.SqlRecommendationReasoningContext] + """ + + _validation = { + "context_parameters": {"readonly": True}, + } + + _attribute_map = { + "reasoning_id": {"key": "reasoningId", "type": "str"}, + "reasoning_string": {"key": "reasoningString", "type": "str"}, + "reasoning_category": {"key": "reasoningCategory", "type": "str"}, + "context_parameters": {"key": "contextParameters", "type": "[SqlRecommendationReasoningContext]"}, + } + + def __init__( + self, + *, + reasoning_id: Optional[str] = None, + reasoning_string: Optional[str] = None, + reasoning_category: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword reasoning_id: Gets the reasoning id. + :paramtype reasoning_id: str + :keyword reasoning_string: Gets the reasoning status. + :paramtype reasoning_string: str + :keyword reasoning_category: Gets the reasoning category. + :paramtype reasoning_category: str + """ + super().__init__(**kwargs) + self.reasoning_id = reasoning_id + self.reasoning_string = reasoning_string + self.reasoning_category = reasoning_category + self.context_parameters = None + + +class SqlRecommendationReasoningContext(_serialization.Model): + """Class representing Azure SQL Recommendation Reasoning Context. + + :ivar context_key: Gets the reasoning context key. + :vartype context_key: str + :ivar context_value: Gets the reasoning context value. + :vartype context_value: str + """ + + _attribute_map = { + "context_key": {"key": "contextKey", "type": "str"}, + "context_value": {"key": "contextValue", "type": "str"}, + } + + def __init__( + self, *, context_key: Optional[str] = None, context_value: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword context_key: Gets the reasoning context key. + :paramtype context_key: str + :keyword context_value: Gets the reasoning context value. + :paramtype context_value: str + """ + super().__init__(**kwargs) + self.context_key = context_key + self.context_value = context_value + + +class SqlServerLicensingSettings(_serialization.Model): + """SQL Server licensing settings. + + All required parameters must be populated in order to send to server. + + :ivar version: SQL Server version. Required. Known values are: "Unknown", "Enterprise", and + "Standard". + :vartype version: str or ~azure.mgmt.migrationassessment.models.SqlServerLicenseType + :ivar license_cost: Licence cost. Required. + :vartype license_cost: float + :ivar software_assurance_cost: Software assurance (SA) cost. Required. + :vartype software_assurance_cost: float + """ + + _validation = { + "version": {"required": True}, + "license_cost": {"required": True}, + "software_assurance_cost": {"required": True}, + } + + _attribute_map = { + "version": {"key": "version", "type": "str"}, + "license_cost": {"key": "licenseCost", "type": "float"}, + "software_assurance_cost": {"key": "softwareAssuranceCost", "type": "float"}, + } + + def __init__( + self, + *, + version: Union[str, "_models.SqlServerLicenseType"], + license_cost: float, + software_assurance_cost: float, + **kwargs: Any + ) -> None: + """ + :keyword version: SQL Server version. Required. Known values are: "Unknown", "Enterprise", and + "Standard". + :paramtype version: str or ~azure.mgmt.migrationassessment.models.SqlServerLicenseType + :keyword license_cost: Licence cost. Required. + :paramtype license_cost: float + :keyword software_assurance_cost: Software assurance (SA) cost. Required. + :paramtype software_assurance_cost: float + """ + super().__init__(**kwargs) + self.version = version + self.license_cost = license_cost + self.software_assurance_cost = software_assurance_cost + + +class SqlServiceTier(_serialization.Model): + """The SQL service tier. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar service_tier_name: The service tier name. + :vartype service_tier_name: str + :ivar service_tier_number: The number of sql entities with this tier. + :vartype service_tier_number: float + """ + + _validation = { + "service_tier_name": {"readonly": True}, + "service_tier_number": {"readonly": True}, + } + + _attribute_map = { + "service_tier_name": {"key": "serviceTierName", "type": "str"}, + "service_tier_number": {"key": "serviceTierNumber", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.service_tier_name = None + self.service_tier_number = None + + +class SqlVersionDetails(_serialization.Model): + """The SQL version details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar sql_version: The SQL version. + :vartype sql_version: str + :ivar number_of_instances: Number of instances with the above SQL version. + :vartype number_of_instances: int + """ + + _validation = { + "sql_version": {"readonly": True}, + "number_of_instances": {"readonly": True}, + } + + _attribute_map = { + "sql_version": {"key": "sqlVersion", "type": "str"}, + "number_of_instances": {"key": "numberOfInstances", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.sql_version = None + self.number_of_instances = None + + +class SqlVmSettings(_serialization.Model): + """SQL VM assessment settings. + + :ivar instance_series: Gets or sets the Azure VM families (calling instance series to keep it + consistent with other targets). + :vartype instance_series: list[str or ~azure.mgmt.migrationassessment.models.AzureVmFamily] + """ + + _attribute_map = { + "instance_series": {"key": "instanceSeries", "type": "[str]"}, + } + + def __init__( + self, *, instance_series: Optional[List[Union[str, "_models.AzureVmFamily"]]] = None, **kwargs: Any + ) -> None: + """ + :keyword instance_series: Gets or sets the Azure VM families (calling instance series to keep + it + consistent with other targets). + :paramtype instance_series: list[str or ~azure.mgmt.migrationassessment.models.AzureVmFamily] + """ + super().__init__(**kwargs) + self.instance_series = instance_series + + +class StorageSettings(_serialization.Model): + """Storage settings. + + All required parameters must be populated in order to send to server. + + :ivar cost_per_gb_per_month: Cost per gigabyte per month. Required. + :vartype cost_per_gb_per_month: float + :ivar maintainance_cost_percentage_to_acquisition_cost: Maintenance cost percentage. Required. + :vartype maintainance_cost_percentage_to_acquisition_cost: float + """ + + _validation = { + "cost_per_gb_per_month": {"required": True}, + "maintainance_cost_percentage_to_acquisition_cost": {"required": True, "maximum": 100, "minimum": 0}, + } + + _attribute_map = { + "cost_per_gb_per_month": {"key": "costPerGbPerMonth", "type": "float"}, + "maintainance_cost_percentage_to_acquisition_cost": { + "key": "maintainanceCostPercentageToAcquisitionCost", + "type": "float", + }, + } + + def __init__( + self, *, cost_per_gb_per_month: float, maintainance_cost_percentage_to_acquisition_cost: float, **kwargs: Any + ) -> None: + """ + :keyword cost_per_gb_per_month: Cost per gigabyte per month. Required. + :paramtype cost_per_gb_per_month: float + :keyword maintainance_cost_percentage_to_acquisition_cost: Maintenance cost percentage. + Required. + :paramtype maintainance_cost_percentage_to_acquisition_cost: float + """ + super().__init__(**kwargs) + self.cost_per_gb_per_month = cost_per_gb_per_month + self.maintainance_cost_percentage_to_acquisition_cost = maintainance_cost_percentage_to_acquisition_cost + + +class SuitabilityResult(_serialization.Model): + """Data model of Suitability Result. + + 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 readiness: Gets readiness. Required. Known values are: "Unknown", "NotReady", + "ReadyWithConditions", and "Ready". + :vartype readiness: str or ~azure.mgmt.migrationassessment.models.Readiness + :ivar suitability: Gets suitability. Required. Known values are: "NotSuitable" and "Suitable". + :vartype suitability: str or ~azure.mgmt.migrationassessment.models.Suitability + :ivar failed_checks: Gets list of failed Checks. Required. + :vartype failed_checks: list[~azure.mgmt.migrationassessment.models.Check] + :ivar suggested_migration_tool: Gets suggested migration tool. Required. Known values are: + "None", "WebAppMigration", and "ServerMigration". + :vartype suggested_migration_tool: str or + ~azure.mgmt.migrationassessment.models.SuggestedMigrationTool + """ + + _validation = { + "readiness": {"required": True, "readonly": True}, + "suitability": {"required": True, "readonly": True}, + "failed_checks": {"required": True, "readonly": True}, + "suggested_migration_tool": {"required": True, "readonly": True}, + } + + _attribute_map = { + "readiness": {"key": "readiness", "type": "str"}, + "suitability": {"key": "suitability", "type": "str"}, + "failed_checks": {"key": "failedChecks", "type": "[Check]"}, + "suggested_migration_tool": {"key": "suggestedMigrationTool", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.readiness = None + self.suitability = None + self.failed_checks = None + self.suggested_migration_tool = None + + +class SummaryDetails(_serialization.Model): + """Data model of Summary Details. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar count: Gets count. Required. + :vartype count: int + :ivar monthly_cost: Gets monthly cost. Required. + :vartype monthly_cost: float + """ + + _validation = { + "count": {"required": True, "readonly": True}, + "monthly_cost": {"required": True, "readonly": True}, + } + + _attribute_map = { + "count": {"key": "count", "type": "int"}, + "monthly_cost": {"key": "monthlyCost", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.count = None + self.monthly_cost = None + + +class SupportStatusDistribution(_serialization.Model): + """Support Status Distribution. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar unknown_support: Unknown support. + :vartype unknown_support: int + :ivar main_stream: Mainstream support. + :vartype main_stream: int + :ivar extended: Extended support. + :vartype extended: int + :ivar out_of_support: Out of support. + :vartype out_of_support: int + """ + + _validation = { + "unknown_support": {"readonly": True}, + "main_stream": {"readonly": True}, + "extended": {"readonly": True}, + "out_of_support": {"readonly": True}, + } + + _attribute_map = { + "unknown_support": {"key": "unknownSupport", "type": "int"}, + "main_stream": {"key": "mainStream", "type": "int"}, + "extended": {"key": "extended", "type": "int"}, + "out_of_support": {"key": "outOfSupport", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.unknown_support = None + self.main_stream = None + self.extended = None + self.out_of_support = None + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.migrationassessment.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.migrationassessment.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or ~azure.mgmt.migrationassessment.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.migrationassessment.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class TargetSpecificResult(_serialization.Model): + """Target specific result. + + All required parameters must be populated in order to send to server. + + :ivar assessment_result: Gets or sets the assessment result. Required. + :vartype assessment_result: ~azure.mgmt.migrationassessment.models.AssessmentResult + :ivar migration_issues: Gets or sets the web app migration issues. Required. + :vartype migration_issues: list[~azure.mgmt.migrationassessment.models.WebAppMigrationIssues] + """ + + _validation = { + "assessment_result": {"required": True}, + "migration_issues": {"required": True}, + } + + _attribute_map = { + "assessment_result": {"key": "assessmentResult", "type": "AssessmentResult"}, + "migration_issues": {"key": "migrationIssues", "type": "[WebAppMigrationIssues]"}, + } + + def __init__( + self, + *, + assessment_result: "_models.AssessmentResult", + migration_issues: List["_models.WebAppMigrationIssues"], + **kwargs: Any + ) -> None: + """ + :keyword assessment_result: Gets or sets the assessment result. Required. + :paramtype assessment_result: ~azure.mgmt.migrationassessment.models.AssessmentResult + :keyword migration_issues: Gets or sets the web app migration issues. Required. + :paramtype migration_issues: list[~azure.mgmt.migrationassessment.models.WebAppMigrationIssues] + """ + super().__init__(**kwargs) + self.assessment_result = assessment_result + self.migration_issues = migration_issues + + +class TargetSpecificSummary(_serialization.Model): + """Web app target specific summary data. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar readiness_summary: Web app readiness summary data. + :vartype readiness_summary: dict[str, int] + :ivar recommendation_result_sku_details: Web app recommendation sku details data. + :vartype recommendation_result_sku_details: dict[str, + ~azure.mgmt.migrationassessment.models.WebAppSkuDetails] + """ + + _validation = { + "readiness_summary": {"readonly": True}, + "recommendation_result_sku_details": {"readonly": True}, + } + + _attribute_map = { + "readiness_summary": {"key": "readinessSummary", "type": "{int}"}, + "recommendation_result_sku_details": {"key": "recommendationResultSkuDetails", "type": "{WebAppSkuDetails}"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.readiness_summary = None + self.recommendation_result_sku_details = None + + +class ThirdPartyManagementSettings(_serialization.Model): + """Third Party Management settings. + + All required parameters must be populated in order to send to server. + + :ivar license_cost: License Cost. Required. + :vartype license_cost: float + :ivar support_cost: Support Cost. Required. + :vartype support_cost: float + """ + + _validation = { + "license_cost": {"required": True}, + "support_cost": {"required": True}, + } + + _attribute_map = { + "license_cost": {"key": "licenseCost", "type": "float"}, + "support_cost": {"key": "supportCost", "type": "float"}, + } + + def __init__(self, *, license_cost: float, support_cost: float, **kwargs: Any) -> None: + """ + :keyword license_cost: License Cost. Required. + :paramtype license_cost: float + :keyword support_cost: Support Cost. Required. + :paramtype support_cost: float + """ + super().__init__(**kwargs) + self.license_cost = license_cost + self.support_cost = support_cost + + +class UltraDiskAssessmentOptions(_serialization.Model): + """Assessment options for Ultra disk type. + + :ivar family_name: Family name. + :vartype family_name: str + :ivar target_locations: List of locations where ultra disk is supported for this VMfamily. + :vartype target_locations: list[str] + """ + + _attribute_map = { + "family_name": {"key": "familyName", "type": "str"}, + "target_locations": {"key": "targetLocations", "type": "[str]"}, + } + + def __init__( + self, *, family_name: Optional[str] = None, target_locations: Optional[List[str]] = None, **kwargs: Any + ) -> None: + """ + :keyword family_name: Family name. + :paramtype family_name: str + :keyword target_locations: List of locations where ultra disk is supported for this VMfamily. + :paramtype target_locations: list[str] + """ + super().__init__(**kwargs) + self.family_name = family_name + self.target_locations = target_locations + + +class UpdateGroupBody(_serialization.Model): + """Properties of group update. + + :ivar e_tag: For optimistic concurrency control. + :vartype e_tag: str + :ivar properties: Properties of the group. + :vartype properties: ~azure.mgmt.migrationassessment.models.GroupBodyProperties + """ + + _attribute_map = { + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "GroupBodyProperties"}, + } + + def __init__( + self, *, e_tag: Optional[str] = None, properties: Optional["_models.GroupBodyProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword e_tag: For optimistic concurrency control. + :paramtype e_tag: str + :keyword properties: Properties of the group. + :paramtype properties: ~azure.mgmt.migrationassessment.models.GroupBodyProperties + """ + super().__init__(**kwargs) + self.e_tag = e_tag + self.properties = properties + + +class UtilizationData(_serialization.Model): + """The SQL on premises utilization insights. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar number_of_active_entities: The number of active entities. + :vartype number_of_active_entities: int + :ivar number_of_inactive_entities: The number of inactive entities. + :vartype number_of_inactive_entities: int + :ivar number_of_decommision_entities: The number of decommission entities. + :vartype number_of_decommision_entities: int + :ivar number_of_unknown_entities: The number of unknown entities. + :vartype number_of_unknown_entities: int + """ + + _validation = { + "number_of_active_entities": {"readonly": True}, + "number_of_inactive_entities": {"readonly": True}, + "number_of_decommision_entities": {"readonly": True}, + "number_of_unknown_entities": {"readonly": True}, + } + + _attribute_map = { + "number_of_active_entities": {"key": "numberOfActiveEntities", "type": "int"}, + "number_of_inactive_entities": {"key": "numberOfInactiveEntities", "type": "int"}, + "number_of_decommision_entities": {"key": "numberOfDecommisionEntities", "type": "int"}, + "number_of_unknown_entities": {"key": "numberOfUnknownEntities", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.number_of_active_entities = None + self.number_of_inactive_entities = None + self.number_of_decommision_entities = None + self.number_of_unknown_entities = None + + +class VirtualizationSoftwareSettings(_serialization.Model): + """Virtualization software settings. + + All required parameters must be populated in order to send to server. + + :ivar v_mware_cloud_foundation_license_cost: VMware cloud foundation license cost. Required. + :vartype v_mware_cloud_foundation_license_cost: float + """ + + _validation = { + "v_mware_cloud_foundation_license_cost": {"required": True}, + } + + _attribute_map = { + "v_mware_cloud_foundation_license_cost": {"key": "vMwareCloudFoundationLicenseCost", "type": "float"}, + } + + def __init__(self, *, v_mware_cloud_foundation_license_cost: float, **kwargs: Any) -> None: + """ + :keyword v_mware_cloud_foundation_license_cost: VMware cloud foundation license cost. Required. + :paramtype v_mware_cloud_foundation_license_cost: float + """ + super().__init__(**kwargs) + self.v_mware_cloud_foundation_license_cost = v_mware_cloud_foundation_license_cost + + +class VmFamilyOptions(_serialization.Model): + """VM family name, the list of targeted azure locations and the category of the + family. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar family_name: Name of the VM family. + :vartype family_name: str + :ivar target_locations: List of Azure regions. + :vartype target_locations: list[str] + :ivar category: Category of the VM family. + :vartype category: list[str] + """ + + _validation = { + "family_name": {"readonly": True}, + "target_locations": {"readonly": True}, + "category": {"readonly": True}, + } + + _attribute_map = { + "family_name": {"key": "familyName", "type": "str"}, + "target_locations": {"key": "targetLocations", "type": "[str]"}, + "category": {"key": "category", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.family_name = None + self.target_locations = None + self.category = None + + +class VmUptime(_serialization.Model): + """Details on the total up-time for the VM. + + :ivar days_per_month: Number of days in a month for VM uptime. + :vartype days_per_month: int + :ivar hours_per_day: Number of hours per day for VM uptime. + :vartype hours_per_day: int + """ + + _attribute_map = { + "days_per_month": {"key": "daysPerMonth", "type": "int"}, + "hours_per_day": {"key": "hoursPerDay", "type": "int"}, + } + + def __init__( + self, *, days_per_month: Optional[int] = None, hours_per_day: Optional[int] = None, **kwargs: Any + ) -> None: + """ + :keyword days_per_month: Number of days in a month for VM uptime. + :paramtype days_per_month: int + :keyword hours_per_day: Number of hours per day for VM uptime. + :paramtype hours_per_day: int + """ + super().__init__(**kwargs) + self.days_per_month = days_per_month + self.hours_per_day = hours_per_day + + +class VmwareCollector(ProxyResource): + """VMware collector 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.CollectorPropertiesBaseWithAgent + """ + + _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": "CollectorPropertiesBaseWithAgent"}, + } + + def __init__( + self, *, properties: Optional["_models.CollectorPropertiesBaseWithAgent"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.CollectorPropertiesBaseWithAgent + """ + super().__init__(**kwargs) + self.properties = properties + + +class VmwareCollectorListResult(_serialization.Model): + """The response of a VmwareCollector list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The VmwareCollector items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.VmwareCollector] + :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": "[VmwareCollector]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.VmwareCollector"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The VmwareCollector items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.VmwareCollector] + :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 VsphereLicenseBase(_serialization.Model): + """Representation of a vsphere licence base. + + All required parameters must be populated in order to send to server. + + :ivar license_cost: Cost of a licence. Required. + :vartype license_cost: float + :ivar basic_support_cost: Basic support cost. Required. + :vartype basic_support_cost: float + :ivar production_support_cost: Production support cost. Required. + :vartype production_support_cost: float + """ + + _validation = { + "license_cost": {"required": True}, + "basic_support_cost": {"required": True}, + "production_support_cost": {"required": True}, + } + + _attribute_map = { + "license_cost": {"key": "licenseCost", "type": "float"}, + "basic_support_cost": {"key": "basicSupportCost", "type": "float"}, + "production_support_cost": {"key": "productionSupportCost", "type": "float"}, + } + + def __init__( + self, *, license_cost: float, basic_support_cost: float, production_support_cost: float, **kwargs: Any + ) -> None: + """ + :keyword license_cost: Cost of a licence. Required. + :paramtype license_cost: float + :keyword basic_support_cost: Basic support cost. Required. + :paramtype basic_support_cost: float + :keyword production_support_cost: Production support cost. Required. + :paramtype production_support_cost: float + """ + super().__init__(**kwargs) + self.license_cost = license_cost + self.basic_support_cost = basic_support_cost + self.production_support_cost = production_support_cost + + +class VsphereLicense(VsphereLicenseBase): + """Representation of a vsphere licence. + + All required parameters must be populated in order to send to server. + + :ivar license_cost: Cost of a licence. Required. + :vartype license_cost: float + :ivar basic_support_cost: Basic support cost. Required. + :vartype basic_support_cost: float + :ivar production_support_cost: Production support cost. Required. + :vartype production_support_cost: float + :ivar license_type: VSphere licence type. Required. Known values are: "Unknown", + "VSphereStandard", and "VSphereEnterprisePlus". + :vartype license_type: str or ~azure.mgmt.migrationassessment.models.LicenseType + """ + + _validation = { + "license_cost": {"required": True}, + "basic_support_cost": {"required": True}, + "production_support_cost": {"required": True}, + "license_type": {"required": True}, + } + + _attribute_map = { + "license_cost": {"key": "licenseCost", "type": "float"}, + "basic_support_cost": {"key": "basicSupportCost", "type": "float"}, + "production_support_cost": {"key": "productionSupportCost", "type": "float"}, + "license_type": {"key": "licenseType", "type": "str"}, + } + + def __init__( + self, + *, + license_cost: float, + basic_support_cost: float, + production_support_cost: float, + license_type: Union[str, "_models.LicenseType"], + **kwargs: Any + ) -> None: + """ + :keyword license_cost: Cost of a licence. Required. + :paramtype license_cost: float + :keyword basic_support_cost: Basic support cost. Required. + :paramtype basic_support_cost: float + :keyword production_support_cost: Production support cost. Required. + :paramtype production_support_cost: float + :keyword license_type: VSphere licence type. Required. Known values are: "Unknown", + "VSphereStandard", and "VSphereEnterprisePlus". + :paramtype license_type: str or ~azure.mgmt.migrationassessment.models.LicenseType + """ + super().__init__( + license_cost=license_cost, + basic_support_cost=basic_support_cost, + production_support_cost=production_support_cost, + **kwargs + ) + self.license_type = license_type + + +class VsphereManagementLicense(VsphereLicenseBase): + """Representation of a vsphere management licence. + + All required parameters must be populated in order to send to server. + + :ivar license_cost: Cost of a licence. Required. + :vartype license_cost: float + :ivar basic_support_cost: Basic support cost. Required. + :vartype basic_support_cost: float + :ivar production_support_cost: Production support cost. Required. + :vartype production_support_cost: float + :ivar license_type: VSphere licence type. Required. Known values are: "Unknown" and + "VSphereServerStandard". + :vartype license_type: str or + ~azure.mgmt.migrationassessment.models.VsphereManagementLicenseType + """ + + _validation = { + "license_cost": {"required": True}, + "basic_support_cost": {"required": True}, + "production_support_cost": {"required": True}, + "license_type": {"required": True}, + } + + _attribute_map = { + "license_cost": {"key": "licenseCost", "type": "float"}, + "basic_support_cost": {"key": "basicSupportCost", "type": "float"}, + "production_support_cost": {"key": "productionSupportCost", "type": "float"}, + "license_type": {"key": "licenseType", "type": "str"}, + } + + def __init__( + self, + *, + license_cost: float, + basic_support_cost: float, + production_support_cost: float, + license_type: Union[str, "_models.VsphereManagementLicenseType"], + **kwargs: Any + ) -> None: + """ + :keyword license_cost: Cost of a licence. Required. + :paramtype license_cost: float + :keyword basic_support_cost: Basic support cost. Required. + :paramtype basic_support_cost: float + :keyword production_support_cost: Production support cost. Required. + :paramtype production_support_cost: float + :keyword license_type: VSphere licence type. Required. Known values are: "Unknown" and + "VSphereServerStandard". + :paramtype license_type: str or + ~azure.mgmt.migrationassessment.models.VsphereManagementLicenseType + """ + super().__init__( + license_cost=license_cost, + basic_support_cost=basic_support_cost, + production_support_cost=production_support_cost, + **kwargs + ) + self.license_type = license_type + + +class VsphereManagementSettings(_serialization.Model): + """Vsphere management settings. + + All required parameters must be populated in order to send to server. + + :ivar license_and_support_list: Licence and support list. Required. + :vartype license_and_support_list: + list[~azure.mgmt.migrationassessment.models.VsphereManagementLicense] + """ + + _validation = { + "license_and_support_list": {"required": True}, + } + + _attribute_map = { + "license_and_support_list": {"key": "licenseAndSupportList", "type": "[VsphereManagementLicense]"}, + } + + def __init__(self, *, license_and_support_list: List["_models.VsphereManagementLicense"], **kwargs: Any) -> None: + """ + :keyword license_and_support_list: Licence and support list. Required. + :paramtype license_and_support_list: + list[~azure.mgmt.migrationassessment.models.VsphereManagementLicense] + """ + super().__init__(**kwargs) + self.license_and_support_list = license_and_support_list + + +class WebAppAssessmentOptions(ProxyResource): + """Web app Assessment options web model object. + + 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.WebAppAssessmentOptionsProperties + """ + + _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": "WebAppAssessmentOptionsProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.WebAppAssessmentOptionsProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.WebAppAssessmentOptionsProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class WebAppAssessmentOptionsListResult(_serialization.Model): + """The response of a WebAppAssessmentOptions list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The WebAppAssessmentOptions items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.WebAppAssessmentOptions] + :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": "[WebAppAssessmentOptions]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.WebAppAssessmentOptions"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The WebAppAssessmentOptions items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.WebAppAssessmentOptions] + :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 WebAppAssessmentOptionsProperties(_serialization.Model): + """Web app Assessment options properties Web model object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar web_app_skus: Gets the list of web app target options. + :vartype web_app_skus: list[~azure.mgmt.migrationassessment.models.WebAppTargetOptions] + :ivar savings_plan_supported_locations: Gets or sets the list of Azure locations supporting + Saving Plans for IAAS. + :vartype savings_plan_supported_locations: list[str or + ~azure.mgmt.migrationassessment.models.AzureLocation] + :ivar reserved_instance_supported_locations: Gets or sets the list of Azure locations + supporting Reserved Instances. + :vartype reserved_instance_supported_locations: list[str or + ~azure.mgmt.migrationassessment.models.AzureLocation] + :ivar reserved_instance_supported_currencies: Gets or sets the list of currencies supported for + Reserved Instances. + :vartype reserved_instance_supported_currencies: list[str or + ~azure.mgmt.migrationassessment.models.AzureCurrency] + :ivar reserved_instance_supported_offers: Gets or sets the list of offers supported for + Reserved Instances. + :vartype reserved_instance_supported_offers: list[str or + ~azure.mgmt.migrationassessment.models.AzureOfferCode] + :ivar reserved_instance_supported_web_app_tiers: Gets or sets the list of currencies supported + for Reserved Instances. + :vartype reserved_instance_supported_web_app_tiers: list[str or + ~azure.mgmt.migrationassessment.models.AzureWebAppTier] + :ivar savings_plan_supported_web_app_tiers: Gets or sets the list of Azure Offers supporting + Saving Plans. + :vartype savings_plan_supported_web_app_tiers: list[str or + ~azure.mgmt.migrationassessment.models.AzureWebAppTier] + """ + + _validation = { + "web_app_skus": {"readonly": True}, + } + + _attribute_map = { + "web_app_skus": {"key": "webAppSkus", "type": "[WebAppTargetOptions]"}, + "savings_plan_supported_locations": {"key": "savingsPlanSupportedLocations", "type": "[str]"}, + "reserved_instance_supported_locations": {"key": "reservedInstanceSupportedLocations", "type": "[str]"}, + "reserved_instance_supported_currencies": {"key": "reservedInstanceSupportedCurrencies", "type": "[str]"}, + "reserved_instance_supported_offers": {"key": "reservedInstanceSupportedOffers", "type": "[str]"}, + "reserved_instance_supported_web_app_tiers": {"key": "reservedInstanceSupportedWebAppTiers", "type": "[str]"}, + "savings_plan_supported_web_app_tiers": {"key": "savingsPlanSupportedWebAppTiers", "type": "[str]"}, + } + + def __init__( + self, + *, + savings_plan_supported_locations: Optional[List[Union[str, "_models.AzureLocation"]]] = None, + reserved_instance_supported_locations: Optional[List[Union[str, "_models.AzureLocation"]]] = None, + reserved_instance_supported_currencies: Optional[List[Union[str, "_models.AzureCurrency"]]] = None, + reserved_instance_supported_offers: Optional[List[Union[str, "_models.AzureOfferCode"]]] = None, + reserved_instance_supported_web_app_tiers: Optional[List[Union[str, "_models.AzureWebAppTier"]]] = None, + savings_plan_supported_web_app_tiers: Optional[List[Union[str, "_models.AzureWebAppTier"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword savings_plan_supported_locations: Gets or sets the list of Azure locations supporting + Saving Plans for IAAS. + :paramtype savings_plan_supported_locations: list[str or + ~azure.mgmt.migrationassessment.models.AzureLocation] + :keyword reserved_instance_supported_locations: Gets or sets the list of Azure locations + supporting Reserved Instances. + :paramtype reserved_instance_supported_locations: list[str or + ~azure.mgmt.migrationassessment.models.AzureLocation] + :keyword reserved_instance_supported_currencies: Gets or sets the list of currencies supported + for Reserved Instances. + :paramtype reserved_instance_supported_currencies: list[str or + ~azure.mgmt.migrationassessment.models.AzureCurrency] + :keyword reserved_instance_supported_offers: Gets or sets the list of offers supported for + Reserved Instances. + :paramtype reserved_instance_supported_offers: list[str or + ~azure.mgmt.migrationassessment.models.AzureOfferCode] + :keyword reserved_instance_supported_web_app_tiers: Gets or sets the list of currencies + supported for Reserved Instances. + :paramtype reserved_instance_supported_web_app_tiers: list[str or + ~azure.mgmt.migrationassessment.models.AzureWebAppTier] + :keyword savings_plan_supported_web_app_tiers: Gets or sets the list of Azure Offers supporting + Saving Plans. + :paramtype savings_plan_supported_web_app_tiers: list[str or + ~azure.mgmt.migrationassessment.models.AzureWebAppTier] + """ + super().__init__(**kwargs) + self.web_app_skus = None + self.savings_plan_supported_locations = savings_plan_supported_locations + self.reserved_instance_supported_locations = reserved_instance_supported_locations + self.reserved_instance_supported_currencies = reserved_instance_supported_currencies + self.reserved_instance_supported_offers = reserved_instance_supported_offers + self.reserved_instance_supported_web_app_tiers = reserved_instance_supported_web_app_tiers + self.savings_plan_supported_web_app_tiers = savings_plan_supported_web_app_tiers + + +class WebAppAssessmentV2(ProxyResource): + """Web app Assessment REST 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.WebAppAssessmentV2Properties + """ + + _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": "WebAppAssessmentV2Properties"}, + } + + def __init__(self, *, properties: Optional["_models.WebAppAssessmentV2Properties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.WebAppAssessmentV2Properties + """ + super().__init__(**kwargs) + self.properties = properties + + +class WebAppAssessmentV2ListResult(_serialization.Model): + """The response of a WebAppAssessmentV2 list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The WebAppAssessmentV2 items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.WebAppAssessmentV2] + :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": "[WebAppAssessmentV2]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.WebAppAssessmentV2"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The WebAppAssessmentV2 items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.WebAppAssessmentV2] + :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 WebAppAssessmentV2Properties(AzureResourceProperties2): + """Web app assessment properties class. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningState2 + :ivar environment_type: Gets or sets user configurable setting to display the environment type. + Known values are: "Production" and "Test". + :vartype environment_type: str or ~azure.mgmt.migrationassessment.models.EnvironmentType + :ivar entity_uptime: Gets or sets the duration for which the entity (Web app, VMs) are up in + the + on-premises environment. + :vartype entity_uptime: ~azure.mgmt.migrationassessment.models.EntityUptime + :ivar ea_subscription_id: Gets or sets the Enterprise agreement subscription id. + :vartype ea_subscription_id: str + :ivar app_svc_native_settings: Gets or sets user configurable app service native settings. + :vartype app_svc_native_settings: ~azure.mgmt.migrationassessment.models.AppSvcNativeSettings + :ivar app_svc_container_settings: Gets or sets user configurable app service container database + settings. + :vartype app_svc_container_settings: + ~azure.mgmt.migrationassessment.models.AppSvcContainerSettings + :ivar discovered_entity_light_summary: Gets or sets user configurable discovered entity + settings. + :vartype discovered_entity_light_summary: + ~azure.mgmt.migrationassessment.models.DiscoveredEntityLightSummary + :ivar azure_security_offering_type: Gets or sets a value indicating azure security offering + type. Known values are: "NO" and "MDC". + :vartype azure_security_offering_type: str or + ~azure.mgmt.migrationassessment.models.AzureSecurityOfferingType + :ivar reserved_instance: Reserved instance. Known values are: "None", "RI1Year", and "RI3Year". + :vartype reserved_instance: str or ~azure.mgmt.migrationassessment.models.AzureReservedInstance + :ivar group_type: Gets the group type for the assessment. Known values are: "Default", + "Import", and "Import". + :vartype group_type: str or ~azure.mgmt.migrationassessment.models.GroupType + :ivar assessment_type: Assessment type of the assessment. Known values are: "Unknown", + "MachineAssessment", "AvsAssessment", "SqlAssessment", and "WebAppAssessment". + :vartype assessment_type: str or ~azure.mgmt.migrationassessment.models.AssessmentType + :ivar azure_location: Azure Location or Azure region where to which the machines will be + migrated. + :vartype azure_location: str + :ivar azure_offer_code: Azure Offer Code. Known values are: "Unknown", "MSAZR0003P", + "MSAZR0044P", "MSAZR0059P", "MSAZR0060P", "MSAZR0062P", "MSAZR0063P", "MSAZR0064P", + "MSAZR0029P", "MSAZR0022P", "MSAZR0023P", "MSAZR0148P", "MSAZR0025P", "MSAZR0036P", + "MSAZR0120P", "MSAZR0121P", "MSAZR0122P", "MSAZR0123P", "MSAZR0124P", "MSAZR0125P", + "MSAZR0126P", "MSAZR0127P", "MSAZR0128P", "MSAZR0129P", "MSAZR0130P", "MSAZR0111P", + "MSAZR0144P", "MSAZR0149P", "MSMCAZR0044P", "MSMCAZR0059P", "MSMCAZR0060P", "MSMCAZR0063P", + "MSMCAZR0120P", "MSMCAZR0121P", "MSMCAZR0125P", "MSMCAZR0128P", "MSAZRDE0003P", "MSAZRDE0044P", + "MSAZRUSGOV0003P", "EA", "MSAZR0243P", "SavingsPlan1Year", and "SavingsPlan3Year". + :vartype azure_offer_code: str or ~azure.mgmt.migrationassessment.models.AzureOfferCode + :ivar currency: Currency in which prices should be reported. Known values are: "Unknown", + "USD", "DKK", "CAD", "IDR", "JPY", "KRW", "NZD", "NOK", "RUB", "SAR", "ZAR", "SEK", "TRY", + "GBP", "MXN", "MYR", "INR", "HKD", "BRL", "TWD", "EUR", "CHF", "ARS", "AUD", "CNY", and "TRY". + :vartype currency: str or ~azure.mgmt.migrationassessment.models.AzureCurrency + :ivar scaling_factor: Percentage of buffer that user wants on performance metrics when + recommending + Azure sizes. + :vartype scaling_factor: float + :ivar percentile: Percentile of the utilization data values to be considered while assessing + machines. Known values are: "Percentile50", "Percentile90", "Percentile95", and + "Percentile99". + :vartype percentile: str or ~azure.mgmt.migrationassessment.models.Percentile + :ivar time_range: Time Range for which the historic utilization data should be considered for + assessment. Known values are: "Day", "Week", "Month", and "Custom". + :vartype time_range: str or ~azure.mgmt.migrationassessment.models.TimeRange + :ivar perf_data_start_time: Gets or sets the start time to consider performance data for + assessment. + :vartype perf_data_start_time: ~datetime.datetime + :ivar perf_data_end_time: Gets or sets the end time to consider performance data for + assessment. + :vartype perf_data_end_time: ~datetime.datetime + :ivar stage: User configurable setting to display the Stage of Assessment. Known values are: + "InProgress", "UnderReview", and "Approved". + :vartype stage: str or ~azure.mgmt.migrationassessment.models.AssessmentStage + :ivar discount_percentage: Custom discount percentage. + :vartype discount_percentage: float + :ivar sizing_criterion: Assessment sizing criterion. Known values are: "PerformanceBased" and + "AsOnPremises". + :vartype sizing_criterion: str or + ~azure.mgmt.migrationassessment.models.AssessmentSizingCriterion + :ivar confidence_rating_in_percentage: Confidence Rating in Percentage. + :vartype confidence_rating_in_percentage: float + :ivar prices_timestamp: Last time when rates were queried. + :vartype prices_timestamp: ~datetime.datetime + :ivar created_timestamp: Date and Time when assessment was created. + :vartype created_timestamp: ~datetime.datetime + :ivar updated_timestamp: Date and Time when assessment was last updated. + :vartype updated_timestamp: ~datetime.datetime + :ivar status: Whether assessment is in valid state and all machines have been assessed. Known + values are: "Created", "Updated", "Running", "Completed", "Invalid", "OutOfSync", "OutDated", + and "Deleted". + :vartype status: str or ~azure.mgmt.migrationassessment.models.AssessmentStatus + :ivar schema_version: Schema version. + :vartype schema_version: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "stage": {"readonly": True}, + "prices_timestamp": {"readonly": True}, + "created_timestamp": {"readonly": True}, + "updated_timestamp": {"readonly": True}, + "status": {"readonly": True}, + "schema_version": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "environment_type": {"key": "environmentType", "type": "str"}, + "entity_uptime": {"key": "entityUptime", "type": "EntityUptime"}, + "ea_subscription_id": {"key": "eaSubscriptionId", "type": "str"}, + "app_svc_native_settings": {"key": "appSvcNativeSettings", "type": "AppSvcNativeSettings"}, + "app_svc_container_settings": {"key": "appSvcContainerSettings", "type": "AppSvcContainerSettings"}, + "discovered_entity_light_summary": { + "key": "discoveredEntityLightSummary", + "type": "DiscoveredEntityLightSummary", + }, + "azure_security_offering_type": {"key": "azureSecurityOfferingType", "type": "str"}, + "reserved_instance": {"key": "reservedInstance", "type": "str"}, + "group_type": {"key": "groupType", "type": "str"}, + "assessment_type": {"key": "assessmentType", "type": "str"}, + "azure_location": {"key": "azureLocation", "type": "str"}, + "azure_offer_code": {"key": "azureOfferCode", "type": "str"}, + "currency": {"key": "currency", "type": "str"}, + "scaling_factor": {"key": "scalingFactor", "type": "float"}, + "percentile": {"key": "percentile", "type": "str"}, + "time_range": {"key": "timeRange", "type": "str"}, + "perf_data_start_time": {"key": "perfDataStartTime", "type": "iso-8601"}, + "perf_data_end_time": {"key": "perfDataEndTime", "type": "iso-8601"}, + "stage": {"key": "stage", "type": "str"}, + "discount_percentage": {"key": "discountPercentage", "type": "float"}, + "sizing_criterion": {"key": "sizingCriterion", "type": "str"}, + "confidence_rating_in_percentage": {"key": "confidenceRatingInPercentage", "type": "float"}, + "prices_timestamp": {"key": "pricesTimestamp", "type": "iso-8601"}, + "created_timestamp": {"key": "createdTimestamp", "type": "iso-8601"}, + "updated_timestamp": {"key": "updatedTimestamp", "type": "iso-8601"}, + "status": {"key": "status", "type": "str"}, + "schema_version": {"key": "schemaVersion", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + environment_type: Optional[Union[str, "_models.EnvironmentType"]] = None, + entity_uptime: Optional["_models.EntityUptime"] = None, + ea_subscription_id: Optional[str] = None, + app_svc_native_settings: Optional["_models.AppSvcNativeSettings"] = None, + app_svc_container_settings: Optional["_models.AppSvcContainerSettings"] = None, + discovered_entity_light_summary: Optional["_models.DiscoveredEntityLightSummary"] = None, + azure_security_offering_type: Optional[Union[str, "_models.AzureSecurityOfferingType"]] = None, + reserved_instance: Optional[Union[str, "_models.AzureReservedInstance"]] = None, + group_type: Optional[Union[str, "_models.GroupType"]] = None, + assessment_type: Optional[Union[str, "_models.AssessmentType"]] = None, + azure_location: Optional[str] = None, + azure_offer_code: Optional[Union[str, "_models.AzureOfferCode"]] = None, + currency: Optional[Union[str, "_models.AzureCurrency"]] = None, + scaling_factor: Optional[float] = None, + percentile: Optional[Union[str, "_models.Percentile"]] = None, + time_range: Optional[Union[str, "_models.TimeRange"]] = None, + perf_data_start_time: Optional[datetime.datetime] = None, + perf_data_end_time: Optional[datetime.datetime] = None, + discount_percentage: Optional[float] = None, + sizing_criterion: Optional[Union[str, "_models.AssessmentSizingCriterion"]] = None, + confidence_rating_in_percentage: Optional[float] = None, + **kwargs: Any + ) -> None: + """ + :keyword environment_type: Gets or sets user configurable setting to display the environment + type. Known values are: "Production" and "Test". + :paramtype environment_type: str or ~azure.mgmt.migrationassessment.models.EnvironmentType + :keyword entity_uptime: Gets or sets the duration for which the entity (Web app, VMs) are up in + the + on-premises environment. + :paramtype entity_uptime: ~azure.mgmt.migrationassessment.models.EntityUptime + :keyword ea_subscription_id: Gets or sets the Enterprise agreement subscription id. + :paramtype ea_subscription_id: str + :keyword app_svc_native_settings: Gets or sets user configurable app service native settings. + :paramtype app_svc_native_settings: ~azure.mgmt.migrationassessment.models.AppSvcNativeSettings + :keyword app_svc_container_settings: Gets or sets user configurable app service container + database settings. + :paramtype app_svc_container_settings: + ~azure.mgmt.migrationassessment.models.AppSvcContainerSettings + :keyword discovered_entity_light_summary: Gets or sets user configurable discovered entity + settings. + :paramtype discovered_entity_light_summary: + ~azure.mgmt.migrationassessment.models.DiscoveredEntityLightSummary + :keyword azure_security_offering_type: Gets or sets a value indicating azure security offering + type. Known values are: "NO" and "MDC". + :paramtype azure_security_offering_type: str or + ~azure.mgmt.migrationassessment.models.AzureSecurityOfferingType + :keyword reserved_instance: Reserved instance. Known values are: "None", "RI1Year", and + "RI3Year". + :paramtype reserved_instance: str or + ~azure.mgmt.migrationassessment.models.AzureReservedInstance + :keyword group_type: Gets the group type for the assessment. Known values are: "Default", + "Import", and "Import". + :paramtype group_type: str or ~azure.mgmt.migrationassessment.models.GroupType + :keyword assessment_type: Assessment type of the assessment. Known values are: "Unknown", + "MachineAssessment", "AvsAssessment", "SqlAssessment", and "WebAppAssessment". + :paramtype assessment_type: str or ~azure.mgmt.migrationassessment.models.AssessmentType + :keyword azure_location: Azure Location or Azure region where to which the machines will be + migrated. + :paramtype azure_location: str + :keyword azure_offer_code: Azure Offer Code. Known values are: "Unknown", "MSAZR0003P", + "MSAZR0044P", "MSAZR0059P", "MSAZR0060P", "MSAZR0062P", "MSAZR0063P", "MSAZR0064P", + "MSAZR0029P", "MSAZR0022P", "MSAZR0023P", "MSAZR0148P", "MSAZR0025P", "MSAZR0036P", + "MSAZR0120P", "MSAZR0121P", "MSAZR0122P", "MSAZR0123P", "MSAZR0124P", "MSAZR0125P", + "MSAZR0126P", "MSAZR0127P", "MSAZR0128P", "MSAZR0129P", "MSAZR0130P", "MSAZR0111P", + "MSAZR0144P", "MSAZR0149P", "MSMCAZR0044P", "MSMCAZR0059P", "MSMCAZR0060P", "MSMCAZR0063P", + "MSMCAZR0120P", "MSMCAZR0121P", "MSMCAZR0125P", "MSMCAZR0128P", "MSAZRDE0003P", "MSAZRDE0044P", + "MSAZRUSGOV0003P", "EA", "MSAZR0243P", "SavingsPlan1Year", and "SavingsPlan3Year". + :paramtype azure_offer_code: str or ~azure.mgmt.migrationassessment.models.AzureOfferCode + :keyword currency: Currency in which prices should be reported. Known values are: "Unknown", + "USD", "DKK", "CAD", "IDR", "JPY", "KRW", "NZD", "NOK", "RUB", "SAR", "ZAR", "SEK", "TRY", + "GBP", "MXN", "MYR", "INR", "HKD", "BRL", "TWD", "EUR", "CHF", "ARS", "AUD", "CNY", and "TRY". + :paramtype currency: str or ~azure.mgmt.migrationassessment.models.AzureCurrency + :keyword scaling_factor: Percentage of buffer that user wants on performance metrics when + recommending + Azure sizes. + :paramtype scaling_factor: float + :keyword percentile: Percentile of the utilization data values to be considered while assessing + machines. Known values are: "Percentile50", "Percentile90", "Percentile95", and + "Percentile99". + :paramtype percentile: str or ~azure.mgmt.migrationassessment.models.Percentile + :keyword time_range: Time Range for which the historic utilization data should be considered + for + assessment. Known values are: "Day", "Week", "Month", and "Custom". + :paramtype time_range: str or ~azure.mgmt.migrationassessment.models.TimeRange + :keyword perf_data_start_time: Gets or sets the start time to consider performance data for + assessment. + :paramtype perf_data_start_time: ~datetime.datetime + :keyword perf_data_end_time: Gets or sets the end time to consider performance data for + assessment. + :paramtype perf_data_end_time: ~datetime.datetime + :keyword discount_percentage: Custom discount percentage. + :paramtype discount_percentage: float + :keyword sizing_criterion: Assessment sizing criterion. Known values are: "PerformanceBased" + and "AsOnPremises". + :paramtype sizing_criterion: str or + ~azure.mgmt.migrationassessment.models.AssessmentSizingCriterion + :keyword confidence_rating_in_percentage: Confidence Rating in Percentage. + :paramtype confidence_rating_in_percentage: float + """ + super().__init__(**kwargs) + self.environment_type = environment_type + self.entity_uptime = entity_uptime + self.ea_subscription_id = ea_subscription_id + self.app_svc_native_settings = app_svc_native_settings + self.app_svc_container_settings = app_svc_container_settings + self.discovered_entity_light_summary = discovered_entity_light_summary + self.azure_security_offering_type = azure_security_offering_type + self.reserved_instance = reserved_instance + self.group_type = group_type + self.assessment_type = assessment_type + self.azure_location = azure_location + self.azure_offer_code = azure_offer_code + self.currency = currency + self.scaling_factor = scaling_factor + self.percentile = percentile + self.time_range = time_range + self.perf_data_start_time = perf_data_start_time + self.perf_data_end_time = perf_data_end_time + self.stage = None + self.discount_percentage = discount_percentage + self.sizing_criterion = sizing_criterion + self.confidence_rating_in_percentage = confidence_rating_in_percentage + self.prices_timestamp = None + self.created_timestamp = None + self.updated_timestamp = None + self.status = None + self.schema_version = None + + +class WebAppAssessmentV2Summary(ProxyResource): + """Web app Assessment REST 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.WebAppAssessmentV2SummaryProperties + """ + + _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": "WebAppAssessmentV2SummaryProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.WebAppAssessmentV2SummaryProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: + ~azure.mgmt.migrationassessment.models.WebAppAssessmentV2SummaryProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class WebAppAssessmentV2SummaryListResult(_serialization.Model): + """The response of a WebAppAssessmentV2Summary list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The WebAppAssessmentV2Summary items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.WebAppAssessmentV2Summary] + :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": "[WebAppAssessmentV2Summary]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.WebAppAssessmentV2Summary"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The WebAppAssessmentV2Summary items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.WebAppAssessmentV2Summary] + :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 WebAppAssessmentV2SummaryProperties(_serialization.Model): + """Web app Assessment V2 summary properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar assessment_summary: Gets or sets the discovered entities summary. + :vartype assessment_summary: dict[str, + ~azure.mgmt.migrationassessment.models.DiscoveredEntitiesSummary] + :ivar target_specific_summary: Gets the target specific summary. + :vartype target_specific_summary: dict[str, + ~azure.mgmt.migrationassessment.models.TargetSpecificSummary] + """ + + _validation = { + "assessment_summary": {"readonly": True}, + "target_specific_summary": {"readonly": True}, + } + + _attribute_map = { + "assessment_summary": {"key": "assessmentSummary", "type": "{DiscoveredEntitiesSummary}"}, + "target_specific_summary": {"key": "targetSpecificSummary", "type": "{TargetSpecificSummary}"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.assessment_summary = None + self.target_specific_summary = None + + +class WebAppCollector(ProxyResource): + """The web app collector REST object. + + 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: + ~azure.mgmt.migrationassessment.models.WebAppCollectorPropertiesBaseWithAgent + """ + + _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": "WebAppCollectorPropertiesBaseWithAgent"}, + } + + def __init__( + self, *, properties: Optional["_models.WebAppCollectorPropertiesBaseWithAgent"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: + ~azure.mgmt.migrationassessment.models.WebAppCollectorPropertiesBaseWithAgent + """ + super().__init__(**kwargs) + self.properties = properties + + +class WebAppCollectorListResult(_serialization.Model): + """The response of a WebAppCollector list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The WebAppCollector items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.WebAppCollector] + :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": "[WebAppCollector]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.WebAppCollector"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The WebAppCollector items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.WebAppCollector] + :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 WebAppCollectorPropertiesBaseWithAgent(AzureResourceProperties2): + """Collector properties class. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.migrationassessment.models.ProvisioningState2 + :ivar agent_properties: Gets or sets the collector agent properties. + :vartype agent_properties: ~azure.mgmt.migrationassessment.models.CollectorAgentPropertiesBase + :ivar discovery_site_id: Gets the discovery site id. + :vartype discovery_site_id: str + :ivar created_timestamp: Gets the Timestamp when collector was created. + :vartype created_timestamp: ~datetime.datetime + :ivar updated_timestamp: Timestamp when collector was last updated. + :vartype updated_timestamp: ~datetime.datetime + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "created_timestamp": {"readonly": True}, + "updated_timestamp": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "agent_properties": {"key": "agentProperties", "type": "CollectorAgentPropertiesBase"}, + "discovery_site_id": {"key": "discoverySiteId", "type": "str"}, + "created_timestamp": {"key": "createdTimestamp", "type": "iso-8601"}, + "updated_timestamp": {"key": "updatedTimestamp", "type": "iso-8601"}, + } + + def __init__( + self, + *, + agent_properties: Optional["_models.CollectorAgentPropertiesBase"] = None, + discovery_site_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword agent_properties: Gets or sets the collector agent properties. + :paramtype agent_properties: + ~azure.mgmt.migrationassessment.models.CollectorAgentPropertiesBase + :keyword discovery_site_id: Gets the discovery site id. + :paramtype discovery_site_id: str + """ + super().__init__(**kwargs) + self.agent_properties = agent_properties + self.discovery_site_id = discovery_site_id + self.created_timestamp = None + self.updated_timestamp = None + + +class WebAppDistribution(_serialization.Model): + """The app type distribution. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar web_app_type: WebApp type. Known values are: "Unknown", "ASPNET", and "Java". + :vartype web_app_type: str or ~azure.mgmt.migrationassessment.models.WebAppTypes + :ivar number_of_web_apps: The cost details. + :vartype number_of_web_apps: float + """ + + _validation = { + "web_app_type": {"readonly": True}, + "number_of_web_apps": {"readonly": True}, + } + + _attribute_map = { + "web_app_type": {"key": "webAppType", "type": "str"}, + "number_of_web_apps": {"key": "numberOfWebApps", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.web_app_type = None + self.number_of_web_apps = None + + +class WebAppMigrationIssues(_serialization.Model): + """Web app migration issues. + + All required parameters must be populated in order to send to server. + + :ivar issue_id: Gets or sets the issue Id. Required. + :vartype issue_id: str + :ivar issue_category: Gets or sets the issue category. Required. Known values are: "Unknown", + "Issue", and "Info". + :vartype issue_category: str or + ~azure.mgmt.migrationassessment.models.AzureWebAppSuitabilityIssueCategory + :ivar issue_description_list: Gets or sets the issue description list. Required. + :vartype issue_description_list: list[str] + """ + + _validation = { + "issue_id": {"required": True}, + "issue_category": {"required": True}, + "issue_description_list": {"required": True}, + } + + _attribute_map = { + "issue_id": {"key": "issueId", "type": "str"}, + "issue_category": {"key": "issueCategory", "type": "str"}, + "issue_description_list": {"key": "issueDescriptionList", "type": "[str]"}, + } + + def __init__( + self, + *, + issue_id: str, + issue_category: Union[str, "_models.AzureWebAppSuitabilityIssueCategory"], + issue_description_list: List[str], + **kwargs: Any + ) -> None: + """ + :keyword issue_id: Gets or sets the issue Id. Required. + :paramtype issue_id: str + :keyword issue_category: Gets or sets the issue category. Required. Known values are: + "Unknown", "Issue", and "Info". + :paramtype issue_category: str or + ~azure.mgmt.migrationassessment.models.AzureWebAppSuitabilityIssueCategory + :keyword issue_description_list: Gets or sets the issue description list. Required. + :paramtype issue_description_list: list[str] + """ + super().__init__(**kwargs) + self.issue_id = issue_id + self.issue_category = issue_category + self.issue_description_list = issue_description_list + + +class WebAppServicePlanV2(ProxyResource): + """Assessed Web app web model class. + + 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.migrationassessment.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.migrationassessment.models.WebAppServicePlanV2Properties + """ + + _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": "WebAppServicePlanV2Properties"}, + } + + def __init__(self, *, properties: Optional["_models.WebAppServicePlanV2Properties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.migrationassessment.models.WebAppServicePlanV2Properties + """ + super().__init__(**kwargs) + self.properties = properties + + +class WebAppServicePlanV2ListResult(_serialization.Model): + """The response of a WebAppServicePlanV2 list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The WebAppServicePlanV2 items on this page. Required. + :vartype value: list[~azure.mgmt.migrationassessment.models.WebAppServicePlanV2] + :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": "[WebAppServicePlanV2]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.WebAppServicePlanV2"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The WebAppServicePlanV2 items on this page. Required. + :paramtype value: list[~azure.mgmt.migrationassessment.models.WebAppServicePlanV2] + :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 WebAppServicePlanV2Properties(_serialization.Model): + """Assessed Web app database properties web model. + + 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 web_app_type: Gets or sets the web app type. Known values are: "Unknown", "IIS", and + "Tomcat". + :vartype web_app_type: str or ~azure.mgmt.migrationassessment.models.WebAppType + :ivar web_app_target_type: Gets or sets the target specific result. Known values are: + "Unknown", "AzureAppService", and "AzureAppServiceContainer". + :vartype web_app_target_type: str or + ~azure.mgmt.migrationassessment.models.AzureWebAppTargetType + :ivar web_app_service_plan_name: Gets or sets the app service plan name. Required. + :vartype web_app_service_plan_name: str + :ivar number_of_web_apps: Gets the machine name. Required. + :vartype number_of_web_apps: int + :ivar monthly_cost: Gets or sets the server ARM Id. + :vartype monthly_cost: float + :ivar storage: Gets or sets the web server name. + :vartype storage: float + :ivar scale_out_instances: Gets or sets web app name. + :vartype scale_out_instances: int + :ivar cores: Gets the discovered web app ID. + :vartype cores: int + :ivar ram: Machine arm id. + :vartype ram: float + :ivar web_app_sku_name: Web app sku name. + :vartype web_app_sku_name: str + :ivar web_app_sku_size: Web app sku size. + :vartype web_app_sku_size: str + :ivar created_timestamp: When was assessed SQL database first created. + :vartype created_timestamp: ~datetime.datetime + :ivar updated_timestamp: When was assessed Web app database last updated. + :vartype updated_timestamp: ~datetime.datetime + :ivar cost_components: Cost components. + :vartype cost_components: list[~azure.mgmt.migrationassessment.models.CostComponent] + """ + + _validation = { + "web_app_type": {"readonly": True}, + "web_app_target_type": {"readonly": True}, + "web_app_service_plan_name": {"required": True, "readonly": True}, + "number_of_web_apps": {"required": True, "readonly": True}, + "monthly_cost": {"readonly": True}, + "storage": {"readonly": True}, + "scale_out_instances": {"readonly": True}, + "cores": {"readonly": True}, + "ram": {"readonly": True}, + "web_app_sku_name": {"readonly": True}, + "web_app_sku_size": {"readonly": True}, + "created_timestamp": {"readonly": True}, + "updated_timestamp": {"readonly": True}, + "cost_components": {"readonly": True}, + } + + _attribute_map = { + "web_app_type": {"key": "webAppType", "type": "str"}, + "web_app_target_type": {"key": "webAppTargetType", "type": "str"}, + "web_app_service_plan_name": {"key": "webAppServicePlanName", "type": "str"}, + "number_of_web_apps": {"key": "numberOfWebApps", "type": "int"}, + "monthly_cost": {"key": "monthlyCost", "type": "float"}, + "storage": {"key": "storage", "type": "float"}, + "scale_out_instances": {"key": "scaleOutInstances", "type": "int"}, + "cores": {"key": "cores", "type": "int"}, + "ram": {"key": "ram", "type": "float"}, + "web_app_sku_name": {"key": "webAppSkuName", "type": "str"}, + "web_app_sku_size": {"key": "webAppSkuSize", "type": "str"}, + "created_timestamp": {"key": "createdTimestamp", "type": "iso-8601"}, + "updated_timestamp": {"key": "updatedTimestamp", "type": "iso-8601"}, + "cost_components": {"key": "costComponents", "type": "[CostComponent]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.web_app_type = None + self.web_app_target_type = None + self.web_app_service_plan_name = None + self.number_of_web_apps = None + self.monthly_cost = None + self.storage = None + self.scale_out_instances = None + self.cores = None + self.ram = None + self.web_app_sku_name = None + self.web_app_sku_size = None + self.created_timestamp = None + self.updated_timestamp = None + self.cost_components = None + + +class WebAppSkuDetails(_serialization.Model): + """Web app sku details. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar total_monthly_cost: Total monthly cost. + :vartype total_monthly_cost: float + :ivar monthly_security_cost: Monthly security data. + :vartype monthly_security_cost: float + :ivar sku_name: Sku name. Required. + :vartype sku_name: str + :ivar sku_size: Sku size. Required. + :vartype sku_size: str + :ivar app_service_plan_count: App service plan count. Required. + :vartype app_service_plan_count: int + """ + + _validation = { + "total_monthly_cost": {"readonly": True}, + "monthly_security_cost": {"readonly": True}, + "sku_name": {"required": True, "readonly": True}, + "sku_size": {"required": True, "readonly": True}, + "app_service_plan_count": {"required": True, "readonly": True}, + } + + _attribute_map = { + "total_monthly_cost": {"key": "totalMonthlyCost", "type": "float"}, + "monthly_security_cost": {"key": "monthlySecurityCost", "type": "float"}, + "sku_name": {"key": "skuName", "type": "str"}, + "sku_size": {"key": "skuSize", "type": "str"}, + "app_service_plan_count": {"key": "appServicePlanCount", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.total_monthly_cost = None + self.monthly_security_cost = None + self.sku_name = None + self.sku_size = None + self.app_service_plan_count = None + + +class WebAppTargetOptions(_serialization.Model): + """Web app target options. + + :ivar web_app_tier: Gets or sets the Azure web app tier. Known values are: "Unknown", "Free", + "Premium_V2", "Premium_V3", and "Isolated". + :vartype web_app_tier: str or ~azure.mgmt.migrationassessment.models.AzureWebAppTier + :ivar target_locations: Gets or sets the target location. + :vartype target_locations: list[str or ~azure.mgmt.migrationassessment.models.AzureLocation] + """ + + _attribute_map = { + "web_app_tier": {"key": "webAppTier", "type": "str"}, + "target_locations": {"key": "targetLocations", "type": "[str]"}, + } + + def __init__( + self, + *, + web_app_tier: Optional[Union[str, "_models.AzureWebAppTier"]] = None, + target_locations: Optional[List[Union[str, "_models.AzureLocation"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword web_app_tier: Gets or sets the Azure web app tier. Known values are: "Unknown", + "Free", "Premium_V2", "Premium_V3", and "Isolated". + :paramtype web_app_tier: str or ~azure.mgmt.migrationassessment.models.AzureWebAppTier + :keyword target_locations: Gets or sets the target location. + :paramtype target_locations: list[str or ~azure.mgmt.migrationassessment.models.AzureLocation] + """ + super().__init__(**kwargs) + self.web_app_tier = web_app_tier + self.target_locations = target_locations + + +class WebAppTargetSku(_serialization.Model): + """The Webapp target SKU with corresponding cost. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar sku_name: The SKU name. + :vartype sku_name: str + :ivar cost: The cost details. + :vartype cost: float + :ivar count: The number of service plans or node pools recommended. + :vartype count: int + """ + + _validation = { + "sku_name": {"readonly": True}, + "cost": {"readonly": True}, + "count": {"readonly": True}, + } + + _attribute_map = { + "sku_name": {"key": "skuName", "type": "str"}, + "cost": {"key": "cost", "type": "float"}, + "count": {"key": "count", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.sku_name = None + self.cost = None + self.count = None + + +class WindowsServerLicensingSettings(_serialization.Model): + """Windows Server licensing settings. + + All required parameters must be populated in order to send to server. + + :ivar license_cost: Licence Cost. Required. + :vartype license_cost: float + :ivar software_assurance_cost: Software assurance (SA) cost. Required. + :vartype software_assurance_cost: float + :ivar licenses_per_core: Licenses per core. Required. + :vartype licenses_per_core: int + """ + + _validation = { + "license_cost": {"required": True}, + "software_assurance_cost": {"required": True}, + "licenses_per_core": {"required": True}, + } + + _attribute_map = { + "license_cost": {"key": "licenseCost", "type": "float"}, + "software_assurance_cost": {"key": "softwareAssuranceCost", "type": "float"}, + "licenses_per_core": {"key": "licensesPerCore", "type": "int"}, + } + + def __init__( + self, *, license_cost: float, software_assurance_cost: float, licenses_per_core: int, **kwargs: Any + ) -> None: + """ + :keyword license_cost: Licence Cost. Required. + :paramtype license_cost: float + :keyword software_assurance_cost: Software assurance (SA) cost. Required. + :paramtype software_assurance_cost: float + :keyword licenses_per_core: Licenses per core. Required. + :paramtype licenses_per_core: int + """ + super().__init__(**kwargs) + self.license_cost = license_cost + self.software_assurance_cost = software_assurance_cost + self.licenses_per_core = licenses_per_core + + +class WorkloadSummary(_serialization.Model): + """Workload summary. + + :ivar oracle_instances: Gets or sets oracle databases. + :vartype oracle_instances: int + :ivar spring_apps: Gets or sets oracle databases. + :vartype spring_apps: int + """ + + _attribute_map = { + "oracle_instances": {"key": "oracleInstances", "type": "int"}, + "spring_apps": {"key": "springApps", "type": "int"}, + } + + def __init__( + self, *, oracle_instances: Optional[int] = None, spring_apps: Optional[int] = None, **kwargs: Any + ) -> None: + """ + :keyword oracle_instances: Gets or sets oracle databases. + :paramtype oracle_instances: int + :keyword spring_apps: Gets or sets oracle databases. + :paramtype spring_apps: int + """ + super().__init__(**kwargs) + self.oracle_instances = oracle_instances + self.spring_apps = spring_apps + + +class YearOnYearCost(_serialization.Model): + """Year on Year cost. + + All required parameters must be populated in order to send to server. + + :ivar year: Year value. Required. Known values are: "Year0", "Year1", "Year2", and "Year3". + :vartype year: str or ~azure.mgmt.migrationassessment.models.Year + :ivar cost: Cost for the specified year. + :vartype cost: float + """ + + _validation = { + "year": {"required": True}, + } + + _attribute_map = { + "year": {"key": "year", "type": "str"}, + "cost": {"key": "cost", "type": "float"}, + } + + def __init__(self, *, year: Union[str, "_models.Year"], cost: Optional[float] = None, **kwargs: Any) -> None: + """ + :keyword year: Year value. Required. Known values are: "Year0", "Year1", "Year2", and "Year3". + :paramtype year: str or ~azure.mgmt.migrationassessment.models.Year + :keyword cost: Cost for the specified year. + :paramtype cost: float + """ + super().__init__(**kwargs) + self.year = year + self.cost = cost + + +class YearOnYearEstimates(_serialization.Model): + """Shows the year-on-year cost overall. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar on_premises_cost: Year-on-Year on-premises cost. + :vartype on_premises_cost: dict[str, float] + :ivar azure_cost: Year-on-Year Azure cost. + :vartype azure_cost: dict[str, float] + :ivar savings: Year-on-Year savings. + :vartype savings: dict[str, float] + :ivar on_premises_capex_cost: Year-on-Year on-premises capex cost. + :vartype on_premises_capex_cost: dict[str, float] + :ivar on_premises_opex_cost: Year-on-Year on-premises opex cost. + :vartype on_premises_opex_cost: dict[str, float] + :ivar azure_capex_cost: Year-on-Year azure capex cost. + :vartype azure_capex_cost: dict[str, float] + :ivar azure_opex_cost: Year-on-Year azure opex cost. + :vartype azure_opex_cost: dict[str, float] + :ivar payback_period: Payback period. + :vartype payback_period: int + :ivar azure_arc_enabled_on_premises_cost: Year-on-Year azure arc enabled on-premises cost. + :vartype azure_arc_enabled_on_premises_cost: + list[~azure.mgmt.migrationassessment.models.YearOnYearCost] + :ivar future_cost: Year-on-Year azure with arc enabled on-premises cost. + :vartype future_cost: list[~azure.mgmt.migrationassessment.models.YearOnYearCost] + :ivar future_azure_arc_enabled_on_premises_esu_cost: Year-on-Year azure arc enabled on-premises + esu cost of the remaining infra on-premises. + :vartype future_azure_arc_enabled_on_premises_esu_cost: + list[~azure.mgmt.migrationassessment.models.YearOnYearCost] + :ivar future_on_premises_esu_cost: Year-on-Year on-premises esu cost of the remaining infra + on-premises. + :vartype future_on_premises_esu_cost: + list[~azure.mgmt.migrationassessment.models.YearOnYearCost] + """ + + _validation = { + "on_premises_cost": {"readonly": True}, + "azure_cost": {"readonly": True}, + "savings": {"readonly": True}, + "on_premises_capex_cost": {"readonly": True}, + "on_premises_opex_cost": {"readonly": True}, + "azure_capex_cost": {"readonly": True}, + "azure_opex_cost": {"readonly": True}, + "payback_period": {"readonly": True}, + "azure_arc_enabled_on_premises_cost": {"readonly": True}, + "future_cost": {"readonly": True}, + "future_azure_arc_enabled_on_premises_esu_cost": {"readonly": True}, + "future_on_premises_esu_cost": {"readonly": True}, + } + + _attribute_map = { + "on_premises_cost": {"key": "onPremisesCost", "type": "{float}"}, + "azure_cost": {"key": "azureCost", "type": "{float}"}, + "savings": {"key": "savings", "type": "{float}"}, + "on_premises_capex_cost": {"key": "onPremisesCapexCost", "type": "{float}"}, + "on_premises_opex_cost": {"key": "onPremisesOpexCost", "type": "{float}"}, + "azure_capex_cost": {"key": "azureCapexCost", "type": "{float}"}, + "azure_opex_cost": {"key": "azureOpexCost", "type": "{float}"}, + "payback_period": {"key": "paybackPeriod", "type": "int"}, + "azure_arc_enabled_on_premises_cost": {"key": "azureArcEnabledOnPremisesCost", "type": "[YearOnYearCost]"}, + "future_cost": {"key": "futureCost", "type": "[YearOnYearCost]"}, + "future_azure_arc_enabled_on_premises_esu_cost": { + "key": "futureAzureArcEnabledOnPremisesEsuCost", + "type": "[YearOnYearCost]", + }, + "future_on_premises_esu_cost": {"key": "futureOnPremisesEsuCost", "type": "[YearOnYearCost]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.on_premises_cost = None + self.azure_cost = None + self.savings = None + self.on_premises_capex_cost = None + self.on_premises_opex_cost = None + self.azure_capex_cost = None + self.azure_opex_cost = None + self.payback_period = None + self.azure_arc_enabled_on_premises_cost = None + self.future_cost = None + self.future_azure_arc_enabled_on_premises_esu_cost = None + self.future_on_premises_esu_cost = None diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/models/_patch.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/__init__.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/__init__.py new file mode 100644 index 000000000000..4066858e9b1d --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/__init__.py @@ -0,0 +1,115 @@ +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._assessment_projects_operations_operations import AssessmentProjectsOperationsOperations # type: ignore +from ._aks_options_operations_operations import AksOptionsOperationsOperations # type: ignore +from ._aks_assessment_operations_operations import AksAssessmentOperationsOperations # type: ignore +from ._assessed_web_application_operations_operations import AssessedWebApplicationOperationsOperations # type: ignore +from ._aks_cluster_operations_operations import AksClusterOperationsOperations # type: ignore +from ._aks_cost_detail_operations_operations import AksCostDetailOperationsOperations # type: ignore +from ._aks_summary_operations_operations import AksSummaryOperationsOperations # type: ignore +from ._assessment_options_operations_operations import AssessmentOptionsOperationsOperations # type: ignore +from ._avs_assessment_options_operations_operations import AvsAssessmentOptionsOperationsOperations # type: ignore +from ._business_case_operations_operations import BusinessCaseOperationsOperations # type: ignore +from ._business_case_avs_summary_operations_operations import BusinessCaseAvsSummaryOperationsOperations # type: ignore +from ._evaluated_avs_machines_operations_operations import EvaluatedAvsMachinesOperationsOperations # type: ignore +from ._evaluated_machines_operations_operations import EvaluatedMachinesOperationsOperations # type: ignore +from ._evaluated_sql_entities_operations_operations import EvaluatedSqlEntitiesOperationsOperations # type: ignore +from ._evaluated_web_apps_operations_operations import EvaluatedWebAppsOperationsOperations # type: ignore +from ._business_case_iaas_summary_operations_operations import BusinessCaseIaasSummaryOperationsOperations # type: ignore +from ._business_case_overview_summary_operations_operations import BusinessCaseOverviewSummaryOperationsOperations # type: ignore +from ._business_case_paas_summary_operations_operations import BusinessCasePaasSummaryOperationsOperations # type: ignore +from ._groups_operations_operations import GroupsOperationsOperations # type: ignore +from ._assessments_operations_operations import AssessmentsOperationsOperations # type: ignore +from ._assessed_machines_operations_operations import AssessedMachinesOperationsOperations # type: ignore +from ._avs_assessments_operations_operations import AvsAssessmentsOperationsOperations # type: ignore +from ._avs_assessed_machines_operations_operations import AvsAssessedMachinesOperationsOperations # type: ignore +from ._sql_assessment_v2_operations_operations import SqlAssessmentV2OperationsOperations # type: ignore +from ._assessed_sql_database_v2_operations_operations import AssessedSqlDatabaseV2OperationsOperations # type: ignore +from ._assessed_sql_instance_v2_operations_operations import AssessedSqlInstanceV2OperationsOperations # type: ignore +from ._assessed_sql_machines_operations_operations import AssessedSqlMachinesOperationsOperations # type: ignore +from ._assessed_sql_recommended_entity_operations_operations import AssessedSqlRecommendedEntityOperationsOperations # type: ignore +from ._sql_assessment_v2_summary_operations_operations import SqlAssessmentV2SummaryOperationsOperations # type: ignore +from ._web_app_assessment_v2_operations_operations import WebAppAssessmentV2OperationsOperations # type: ignore +from ._assessed_web_app_v2_operations_operations import AssessedWebAppV2OperationsOperations # type: ignore +from ._web_app_assessment_v2_summary_operations_operations import WebAppAssessmentV2SummaryOperationsOperations # type: ignore +from ._web_app_service_plan_v2_operations_operations import WebAppServicePlanV2OperationsOperations # type: ignore +from ._hyperv_collectors_operations_operations import HypervCollectorsOperationsOperations # type: ignore +from ._import_collectors_operations_operations import ImportCollectorsOperationsOperations # type: ignore +from ._machines_operations_operations import MachinesOperationsOperations # type: ignore +from ._private_endpoint_connection_operations_operations import PrivateEndpointConnectionOperationsOperations # type: ignore +from ._private_link_resource_operations_operations import PrivateLinkResourceOperationsOperations # type: ignore +from ._assessment_project_summary_operations_operations import AssessmentProjectSummaryOperationsOperations # type: ignore +from ._server_collectors_operations_operations import ServerCollectorsOperationsOperations # type: ignore +from ._sql_assessment_options_operations_operations import SqlAssessmentOptionsOperationsOperations # type: ignore +from ._sql_collector_operations_operations import SqlCollectorOperationsOperations # type: ignore +from ._vmware_collectors_operations_operations import VmwareCollectorsOperationsOperations # type: ignore +from ._web_app_assessment_options_operations_operations import WebAppAssessmentOptionsOperationsOperations # type: ignore +from ._web_app_collector_operations_operations import WebAppCollectorOperationsOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "Operations", + "AssessmentProjectsOperationsOperations", + "AksOptionsOperationsOperations", + "AksAssessmentOperationsOperations", + "AssessedWebApplicationOperationsOperations", + "AksClusterOperationsOperations", + "AksCostDetailOperationsOperations", + "AksSummaryOperationsOperations", + "AssessmentOptionsOperationsOperations", + "AvsAssessmentOptionsOperationsOperations", + "BusinessCaseOperationsOperations", + "BusinessCaseAvsSummaryOperationsOperations", + "EvaluatedAvsMachinesOperationsOperations", + "EvaluatedMachinesOperationsOperations", + "EvaluatedSqlEntitiesOperationsOperations", + "EvaluatedWebAppsOperationsOperations", + "BusinessCaseIaasSummaryOperationsOperations", + "BusinessCaseOverviewSummaryOperationsOperations", + "BusinessCasePaasSummaryOperationsOperations", + "GroupsOperationsOperations", + "AssessmentsOperationsOperations", + "AssessedMachinesOperationsOperations", + "AvsAssessmentsOperationsOperations", + "AvsAssessedMachinesOperationsOperations", + "SqlAssessmentV2OperationsOperations", + "AssessedSqlDatabaseV2OperationsOperations", + "AssessedSqlInstanceV2OperationsOperations", + "AssessedSqlMachinesOperationsOperations", + "AssessedSqlRecommendedEntityOperationsOperations", + "SqlAssessmentV2SummaryOperationsOperations", + "WebAppAssessmentV2OperationsOperations", + "AssessedWebAppV2OperationsOperations", + "WebAppAssessmentV2SummaryOperationsOperations", + "WebAppServicePlanV2OperationsOperations", + "HypervCollectorsOperationsOperations", + "ImportCollectorsOperationsOperations", + "MachinesOperationsOperations", + "PrivateEndpointConnectionOperationsOperations", + "PrivateLinkResourceOperationsOperations", + "AssessmentProjectSummaryOperationsOperations", + "ServerCollectorsOperationsOperations", + "SqlAssessmentOptionsOperationsOperations", + "SqlCollectorOperationsOperations", + "VmwareCollectorsOperationsOperations", + "WebAppAssessmentOptionsOperationsOperations", + "WebAppCollectorOperationsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_aks_assessment_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_aks_assessment_operations_operations.py new file mode 100644 index 000000000000..ef81a7c5dc4a --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_aks_assessment_operations_operations.py @@ -0,0 +1,827 @@ +# 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 +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +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_assessment_project_request( + resource_group_name: str, + project_name: str, + subscription_id: str, + *, + continuation_token_parameter: Optional[str] = None, + top: Optional[int] = None, + filter: Optional[str] = None, + total_record_count: 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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/aksAssessments", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if continuation_token_parameter is not None: + _params["continuationToken"] = _SERIALIZER.query( + "continuation_token_parameter", continuation_token_parameter, "str" + ) + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if total_record_count is not None: + _params["totalRecordCount"] = _SERIALIZER.query("total_record_count", total_record_count, "int") + + # 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, project_name: str, assessment_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/aksAssessments/{assessmentName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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_request( + resource_group_name: str, project_name: str, assessment_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-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/aksAssessments/{assessmentName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, project_name: str, assessment_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/aksAssessments/{assessmentName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_download_url_request( + resource_group_name: str, + project_name: str, + assessment_name: str, + subscription_id: str, + *, + json: JSON, + **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-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/aksAssessments/{assessmentName}/downloadUrl", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, json=json, **kwargs) + + +class AksAssessmentOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`aks_assessment_operations` 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_assessment_project( + self, + resource_group_name: str, + project_name: str, + continuation_token_parameter: Optional[str] = None, + top: Optional[int] = None, + filter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.AKSAssessment"]: + """List AKSAssessment resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param continuation_token_parameter: Continuation Token Query Parameter. Default value is None. + :type continuation_token_parameter: str + :param top: Page Size Query Parameter. Default value is None. + :type top: int + :param filter: Filter Query Parameter. Default value is None. + :type filter: str + :param total_record_count: Total Record Count Query Parameter. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either AKSAssessment or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.AKSAssessment] + :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.AKSAssessmentListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + continuation_token_parameter=continuation_token_parameter, + top=top, + filter=filter, + total_record_count=total_record_count, + 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("AKSAssessmentListResult", 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, project_name: str, assessment_name: str, **kwargs: Any + ) -> _models.AKSAssessment: + """Get a AKSAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_name: str + :return: AKSAssessment or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AKSAssessment + :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.AKSAssessment] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_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("AKSAssessment", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + project_name: str, + assessment_name: str, + resource: Union[_models.AKSAssessment, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "AKSAssessment") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_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["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( + self, + resource_group_name: str, + project_name: str, + assessment_name: str, + resource: _models.AKSAssessment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AKSAssessment]: + """Create a AKSAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.AKSAssessment + :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 AKSAssessment or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.AKSAssessment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + project_name: str, + assessment_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AKSAssessment]: + """Create a AKSAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AKSAssessment or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.AKSAssessment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + project_name: str, + assessment_name: str, + resource: Union[_models.AKSAssessment, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.AKSAssessment]: + """Create a AKSAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Is either a AKSAssessment type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.migrationassessment.models.AKSAssessment or IO[bytes] + :return: An instance of LROPoller that returns either AKSAssessment or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.AKSAssessment] + :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.AKSAssessment] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_name, + resource=resource, + 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("AKSAssessment", 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.AKSAssessment].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AKSAssessment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, project_name: str, assessment_name: str, **kwargs: Any + ) -> None: + """Delete a AKSAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_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 + + def _download_url_initial( + self, resource_group_name: str, project_name: str, assessment_name: str, body: JSON, **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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _json = self._serialize.body(body, "object") + + _request = build_download_url_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_download_url( + self, resource_group_name: str, project_name: str, assessment_name: str, body: JSON, **kwargs: Any + ) -> LROPoller[_models.DownloadUrl]: + """Get URL for downloading AKS Assessment Report. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_name: str + :param body: The content of the action request. Required. + :type body: JSON + :return: An instance of LROPoller that returns either DownloadUrl or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.DownloadUrl] + :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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.DownloadUrl] = 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._download_url_initial( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_name, + body=body, + 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("DownloadUrl", 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.DownloadUrl].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DownloadUrl]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_aks_cluster_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_aks_cluster_operations_operations.py new file mode 100644 index 000000000000..d159061916db --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_aks_cluster_operations_operations.py @@ -0,0 +1,299 @@ +# 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_aks_assessment_request( + resource_group_name: str, + project_name: str, + assessment_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/aksAssessments/{assessmentName}/clusters", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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_get_request( + resource_group_name: str, + project_name: str, + assessment_name: str, + cluster_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/aksAssessments/{assessmentName}/clusters/{clusterName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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 AksClusterOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`aks_cluster_operations` 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_aks_assessment( + self, + resource_group_name: str, + project_name: str, + assessment_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.AKSCluster"]: + """List AKSCluster resources by AKSAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_name: str + :param filter: Filter Query Parameter. Default value is None. + :type filter: str + :return: An iterator like instance of either AKSCluster or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.AKSCluster] + :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.AKSClusterListResult] = 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_aks_assessment_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_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("AKSClusterListResult", 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, project_name: str, assessment_name: str, cluster_name: str, **kwargs: Any + ) -> _models.AKSCluster: + """Get a AKSCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_name: str + :param cluster_name: AKS Cluster Name. Required. + :type cluster_name: str + :return: AKSCluster or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AKSCluster + :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.AKSCluster] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_name, + cluster_name=cluster_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("AKSCluster", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_aks_cost_detail_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_aks_cost_detail_operations_operations.py new file mode 100644 index 000000000000..26c750841100 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_aks_cost_detail_operations_operations.py @@ -0,0 +1,195 @@ +# 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_aks_assessment_request( + resource_group_name: str, + project_name: str, + assessment_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/aksAssessments/{assessmentName}/costDetails", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class AksCostDetailOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`aks_cost_detail_operations` 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_aks_assessment( + self, + resource_group_name: str, + project_name: str, + assessment_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.AKSCostDetail"]: + """List AKSCostDetail resources by AKSAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_name: str + :param filter: Filter Query Parameter. Default value is None. + :type filter: str + :return: An iterator like instance of either AKSCostDetail or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.AKSCostDetail] + :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.AKSCostDetailListResult] = 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_aks_assessment_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_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("AKSCostDetailListResult", 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/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_aks_options_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_aks_options_operations_operations.py new file mode 100644 index 000000000000..06302f7b4b32 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_aks_options_operations_operations.py @@ -0,0 +1,274 @@ +# 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_assessment_project_request( + resource_group_name: str, project_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/aksAssessmentOptions", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, project_name: str, assessment_options_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/aksAssessmentOptions/{assessmentOptionsName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentOptionsName": _SERIALIZER.url( + "assessment_options_name", assessment_options_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 AksOptionsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`aks_options_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> Iterable["_models.AKSAssessmentOptions"]: + """List AKSAssessmentOptions resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either AKSAssessmentOptions or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.AKSAssessmentOptions] + :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.AKSAssessmentOptionsListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("AKSAssessmentOptionsListResult", 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, project_name: str, assessment_options_name: str, **kwargs: Any + ) -> _models.AKSAssessmentOptions: + """Get a AKSAssessmentOptions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_options_name: AKS Assessment Options Name. Required. + :type assessment_options_name: str + :return: AKSAssessmentOptions or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AKSAssessmentOptions + :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.AKSAssessmentOptions] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_options_name=assessment_options_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("AKSAssessmentOptions", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_aks_summary_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_aks_summary_operations_operations.py new file mode 100644 index 000000000000..4e9c62c4577c --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_aks_summary_operations_operations.py @@ -0,0 +1,283 @@ +# 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_aks_assessment_request( + resource_group_name: str, project_name: str, assessment_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/aksAssessments/{assessmentName}/summaries", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, + project_name: str, + assessment_name: str, + summary_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/aksAssessments/{assessmentName}/summaries/{summaryName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "summaryName": _SERIALIZER.url("summary_name", summary_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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 AksSummaryOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`aks_summary_operations` 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_aks_assessment( + self, resource_group_name: str, project_name: str, assessment_name: str, **kwargs: Any + ) -> Iterable["_models.AKSSummary"]: + """List AKSSummary resources by AKSAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_name: str + :return: An iterator like instance of either AKSSummary or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.AKSSummary] + :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.AKSSummaryListResult] = 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_aks_assessment_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_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("AKSSummaryListResult", 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, project_name: str, assessment_name: str, summary_name: str, **kwargs: Any + ) -> _models.AKSSummary: + """Get a AKSSummary. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_name: str + :param summary_name: AKS Assessment Summary Name. Required. + :type summary_name: str + :return: AKSSummary or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AKSSummary + :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.AKSSummary] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_name, + summary_name=summary_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("AKSSummary", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_machines_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_machines_operations_operations.py new file mode 100644 index 000000000000..ea88badaff37 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_machines_operations_operations.py @@ -0,0 +1,342 @@ +# 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_assessment_request( + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: 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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}/assessedMachines", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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 continuation_token_parameter is not None: + _params["continuationToken"] = _SERIALIZER.query( + "continuation_token_parameter", continuation_token_parameter, "str" + ) + if total_record_count is not None: + _params["totalRecordCount"] = _SERIALIZER.query("total_record_count", total_record_count, "int") + + # 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, + project_name: str, + group_name: str, + assessment_name: str, + assessed_machine_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}/assessedMachines/{assessedMachineName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessedMachineName": _SERIALIZER.url( + "assessed_machine_name", assessed_machine_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 AssessedMachinesOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`assessed_machines_operations` 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_assessment( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.AssessedMachine"]: + """List AssessedMachine resources by Assessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Machine Assessment ARM name. Required. + :type assessment_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either AssessedMachine or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.AssessedMachine] + :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.AssessedMachineListResult] = 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_assessment_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("AssessedMachineListResult", 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, + project_name: str, + group_name: str, + assessment_name: str, + assessed_machine_name: str, + **kwargs: Any + ) -> _models.AssessedMachine: + """Get a AssessedMachine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Machine Assessment ARM name. Required. + :type assessment_name: str + :param assessed_machine_name: Machine assessment Assessed Machine ARM name. Required. + :type assessed_machine_name: str + :return: AssessedMachine or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AssessedMachine + :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.AssessedMachine] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + assessed_machine_name=assessed_machine_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("AssessedMachine", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_sql_database_v2_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_sql_database_v2_operations_operations.py new file mode 100644 index 000000000000..b96e35a6282a --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_sql_database_v2_operations_operations.py @@ -0,0 +1,344 @@ +# 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_sql_assessment_v2_request( + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: 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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/sqlAssessments/{assessmentName}/assessedSqlDatabases", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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 continuation_token_parameter is not None: + _params["continuationToken"] = _SERIALIZER.query( + "continuation_token_parameter", continuation_token_parameter, "str" + ) + if total_record_count is not None: + _params["totalRecordCount"] = _SERIALIZER.query("total_record_count", total_record_count, "int") + + # 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, + project_name: str, + group_name: str, + assessment_name: str, + assessed_sql_database_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/sqlAssessments/{assessmentName}/assessedSqlDatabases/{assessedSqlDatabaseName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessedSqlDatabaseName": _SERIALIZER.url( + "assessed_sql_database_name", assessed_sql_database_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 AssessedSqlDatabaseV2OperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`assessed_sql_database_v2_operations` 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_sql_assessment_v2( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.AssessedSqlDatabaseV2"]: + """List AssessedSqlDatabaseV2 resources by SqlAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either AssessedSqlDatabaseV2 or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.AssessedSqlDatabaseV2] + :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.AssessedSqlDatabaseV2ListResult] = 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_sql_assessment_v2_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("AssessedSqlDatabaseV2ListResult", 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, + project_name: str, + group_name: str, + assessment_name: str, + assessed_sql_database_name: str, + **kwargs: Any + ) -> _models.AssessedSqlDatabaseV2: + """Get a AssessedSqlDatabaseV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param assessed_sql_database_name: Sql assessment Assessed Databases ARM name. Required. + :type assessed_sql_database_name: str + :return: AssessedSqlDatabaseV2 or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AssessedSqlDatabaseV2 + :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.AssessedSqlDatabaseV2] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + assessed_sql_database_name=assessed_sql_database_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("AssessedSqlDatabaseV2", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_sql_instance_v2_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_sql_instance_v2_operations_operations.py new file mode 100644 index 000000000000..8d336fbddcdd --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_sql_instance_v2_operations_operations.py @@ -0,0 +1,344 @@ +# 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_sql_assessment_v2_request( + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: 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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/sqlAssessments/{assessmentName}/assessedSqlInstances", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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 continuation_token_parameter is not None: + _params["continuationToken"] = _SERIALIZER.query( + "continuation_token_parameter", continuation_token_parameter, "str" + ) + if total_record_count is not None: + _params["totalRecordCount"] = _SERIALIZER.query("total_record_count", total_record_count, "int") + + # 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, + project_name: str, + group_name: str, + assessment_name: str, + assessed_sql_instance_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/sqlAssessments/{assessmentName}/assessedSqlInstances/{assessedSqlInstanceName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessedSqlInstanceName": _SERIALIZER.url( + "assessed_sql_instance_name", assessed_sql_instance_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 AssessedSqlInstanceV2OperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`assessed_sql_instance_v2_operations` 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_sql_assessment_v2( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.AssessedSqlInstanceV2"]: + """List AssessedSqlInstanceV2 resources by SqlAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either AssessedSqlInstanceV2 or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.AssessedSqlInstanceV2] + :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.AssessedSqlInstanceV2ListResult] = 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_sql_assessment_v2_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("AssessedSqlInstanceV2ListResult", 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, + project_name: str, + group_name: str, + assessment_name: str, + assessed_sql_instance_name: str, + **kwargs: Any + ) -> _models.AssessedSqlInstanceV2: + """Get a AssessedSqlInstanceV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param assessed_sql_instance_name: Sql assessment Assessed Instance ARM name. Required. + :type assessed_sql_instance_name: str + :return: AssessedSqlInstanceV2 or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AssessedSqlInstanceV2 + :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.AssessedSqlInstanceV2] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + assessed_sql_instance_name=assessed_sql_instance_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("AssessedSqlInstanceV2", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_sql_machines_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_sql_machines_operations_operations.py new file mode 100644 index 000000000000..db99a393a5cd --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_sql_machines_operations_operations.py @@ -0,0 +1,342 @@ +# 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_sql_assessment_v2_request( + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: 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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/sqlAssessments/{assessmentName}/assessedSqlMachines", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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 continuation_token_parameter is not None: + _params["continuationToken"] = _SERIALIZER.query( + "continuation_token_parameter", continuation_token_parameter, "str" + ) + if total_record_count is not None: + _params["totalRecordCount"] = _SERIALIZER.query("total_record_count", total_record_count, "int") + + # 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, + project_name: str, + group_name: str, + assessment_name: str, + assessed_sql_machine_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/sqlAssessments/{assessmentName}/assessedSqlMachines/{assessedSqlMachineName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessedSqlMachineName": _SERIALIZER.url( + "assessed_sql_machine_name", assessed_sql_machine_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 AssessedSqlMachinesOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`assessed_sql_machines_operations` 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_sql_assessment_v2( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.AssessedSqlMachine"]: + """List AssessedSqlMachine resources by SqlAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either AssessedSqlMachine or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.AssessedSqlMachine] + :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.AssessedSqlMachineListResult] = 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_sql_assessment_v2_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("AssessedSqlMachineListResult", 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, + project_name: str, + group_name: str, + assessment_name: str, + assessed_sql_machine_name: str, + **kwargs: Any + ) -> _models.AssessedSqlMachine: + """Get a AssessedSqlMachine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param assessed_sql_machine_name: Sql assessment Assessed Machine ARM name. Required. + :type assessed_sql_machine_name: str + :return: AssessedSqlMachine or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AssessedSqlMachine + :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.AssessedSqlMachine] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + assessed_sql_machine_name=assessed_sql_machine_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("AssessedSqlMachine", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_sql_recommended_entity_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_sql_recommended_entity_operations_operations.py new file mode 100644 index 000000000000..c16fddd7d0c8 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_sql_recommended_entity_operations_operations.py @@ -0,0 +1,345 @@ +# 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_sql_assessment_v2_request( + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: 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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/sqlAssessments/{assessmentName}/recommendedAssessedEntities", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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 continuation_token_parameter is not None: + _params["continuationToken"] = _SERIALIZER.query( + "continuation_token_parameter", continuation_token_parameter, "str" + ) + if total_record_count is not None: + _params["totalRecordCount"] = _SERIALIZER.query("total_record_count", total_record_count, "int") + + # 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, + project_name: str, + group_name: str, + assessment_name: str, + recommended_assessed_entity_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/sqlAssessments/{assessmentName}/recommendedAssessedEntities/{recommendedAssessedEntityName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "recommendedAssessedEntityName": _SERIALIZER.url( + "recommended_assessed_entity_name", recommended_assessed_entity_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 AssessedSqlRecommendedEntityOperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`assessed_sql_recommended_entity_operations` 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_sql_assessment_v2( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.AssessedSqlRecommendedEntity"]: + """List AssessedSqlRecommendedEntity resources by SqlAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either AssessedSqlRecommendedEntity or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.AssessedSqlRecommendedEntity] + :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.AssessedSqlRecommendedEntityListResult] = 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_sql_assessment_v2_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("AssessedSqlRecommendedEntityListResult", 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, + project_name: str, + group_name: str, + assessment_name: str, + recommended_assessed_entity_name: str, + **kwargs: Any + ) -> _models.AssessedSqlRecommendedEntity: + """Get a AssessedSqlRecommendedEntity. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param recommended_assessed_entity_name: Sql assessment Assessed Recommended Entity ARM name. + Required. + :type recommended_assessed_entity_name: str + :return: AssessedSqlRecommendedEntity or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AssessedSqlRecommendedEntity + :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.AssessedSqlRecommendedEntity] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + recommended_assessed_entity_name=recommended_assessed_entity_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("AssessedSqlRecommendedEntity", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_web_app_v2_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_web_app_v2_operations_operations.py new file mode 100644 index 000000000000..4188ee0bfb61 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_web_app_v2_operations_operations.py @@ -0,0 +1,342 @@ +# 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_web_app_assessment_v2_request( # pylint: disable=name-too-long + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: 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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/webAppAssessments/{assessmentName}/assessedWebApps", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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 continuation_token_parameter is not None: + _params["continuationToken"] = _SERIALIZER.query( + "continuation_token_parameter", continuation_token_parameter, "str" + ) + if total_record_count is not None: + _params["totalRecordCount"] = _SERIALIZER.query("total_record_count", total_record_count, "int") + + # 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, + project_name: str, + group_name: str, + assessment_name: str, + assessed_web_app_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/webAppAssessments/{assessmentName}/assessedWebApps/{assessedWebAppName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessedWebAppName": _SERIALIZER.url( + "assessed_web_app_name", assessed_web_app_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 AssessedWebAppV2OperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`assessed_web_app_v2_operations` 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_web_app_assessment_v2( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.AssessedWebAppV2"]: + """List AssessedWebAppV2 resources by WebAppAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Web app Assessment arm name. Required. + :type assessment_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either AssessedWebAppV2 or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.AssessedWebAppV2] + :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.AssessedWebAppV2ListResult] = 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_web_app_assessment_v2_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("AssessedWebAppV2ListResult", 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, + project_name: str, + group_name: str, + assessment_name: str, + assessed_web_app_name: str, + **kwargs: Any + ) -> _models.AssessedWebAppV2: + """Get a AssessedWebAppV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Web app Assessment arm name. Required. + :type assessment_name: str + :param assessed_web_app_name: Assessed web app ARM name. Required. + :type assessed_web_app_name: str + :return: AssessedWebAppV2 or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AssessedWebAppV2 + :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.AssessedWebAppV2] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + assessed_web_app_name=assessed_web_app_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("AssessedWebAppV2", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_web_application_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_web_application_operations_operations.py new file mode 100644 index 000000000000..596967fe7879 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessed_web_application_operations_operations.py @@ -0,0 +1,326 @@ +# 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_aks_assessment_request( + resource_group_name: str, + project_name: str, + assessment_name: str, + subscription_id: str, + *, + continuation_token_parameter: Optional[str] = None, + top: Optional[int] = None, + filter: Optional[str] = None, + total_record_count: 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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/aksAssessments/{assessmentName}/assessedWebApps", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if continuation_token_parameter is not None: + _params["continuationToken"] = _SERIALIZER.query( + "continuation_token_parameter", continuation_token_parameter, "str" + ) + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if total_record_count is not None: + _params["totalRecordCount"] = _SERIALIZER.query("total_record_count", total_record_count, "int") + + # 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, + project_name: str, + assessment_name: str, + assessed_workload: 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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/aksAssessments/{assessmentName}/assessedWebApps/{assessedWorkload}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessedWorkload": _SERIALIZER.url( + "assessed_workload", assessed_workload, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 AssessedWebApplicationOperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`assessed_web_application_operations` 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_aks_assessment( + self, + resource_group_name: str, + project_name: str, + assessment_name: str, + continuation_token_parameter: Optional[str] = None, + top: Optional[int] = None, + filter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.AssessedWebApplication"]: + """List AssessedWebApplication resources by AKSAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_name: str + :param continuation_token_parameter: Continuation Token Query Parameter. Default value is None. + :type continuation_token_parameter: str + :param top: Page Size Query Parameter. Default value is None. + :type top: int + :param filter: Filter Query Parameter. Default value is None. + :type filter: str + :param total_record_count: Total Record Count Query Parameter. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either AssessedWebApplication or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.AssessedWebApplication] + :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.AssessedWebApplicationListResult] = 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_aks_assessment_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + continuation_token_parameter=continuation_token_parameter, + top=top, + filter=filter, + total_record_count=total_record_count, + 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("AssessedWebApplicationListResult", 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, project_name: str, assessment_name: str, assessed_workload: str, **kwargs: Any + ) -> _models.AssessedWebApplication: + """Get a AssessedWebApplication. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_name: AKS Assessment Name. Required. + :type assessment_name: str + :param assessed_workload: Assessed Web Application Name. Required. + :type assessed_workload: str + :return: AssessedWebApplication or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AssessedWebApplication + :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.AssessedWebApplication] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_name=assessment_name, + assessed_workload=assessed_workload, + 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("AssessedWebApplication", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessment_options_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessment_options_operations_operations.py new file mode 100644 index 000000000000..794a4244d040 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessment_options_operations_operations.py @@ -0,0 +1,273 @@ +# 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_assessment_project_request( + resource_group_name: str, project_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/assessmentOptions", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, project_name: str, assessment_options_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/assessmentOptions/{assessmentOptionsName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentOptionsName": _SERIALIZER.url( + "assessment_options_name", assessment_options_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 AssessmentOptionsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`assessment_options_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> Iterable["_models.AssessmentOptions"]: + """List AssessmentOptions resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either AssessmentOptions or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.AssessmentOptions] + :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.AssessmentOptionsListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("AssessmentOptionsListResult", 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, project_name: str, assessment_options_name: str, **kwargs: Any + ) -> _models.AssessmentOptions: + """Get a AssessmentOptions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_options_name: assessment options ARM name. Accepted value is 'default'. + Required. + :type assessment_options_name: str + :return: AssessmentOptions or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AssessmentOptions + :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.AssessmentOptions] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_options_name=assessment_options_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("AssessmentOptions", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessment_project_summary_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessment_project_summary_operations_operations.py new file mode 100644 index 000000000000..69b4d6b20587 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessment_project_summary_operations_operations.py @@ -0,0 +1,274 @@ +# 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_assessment_project_request( + resource_group_name: str, project_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/projectSummary", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, project_name: str, project_summary_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/projectSummary/{projectSummaryName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "projectSummaryName": _SERIALIZER.url( + "project_summary_name", project_summary_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 AssessmentProjectSummaryOperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`assessment_project_summary_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> Iterable["_models.AssessmentProjectSummary"]: + """List AssessmentProjectSummary resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either AssessmentProjectSummary or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.AssessmentProjectSummary] + :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.AssessmentProjectSummaryListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("AssessmentProjectSummaryListResult", 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, project_name: str, project_summary_name: str, **kwargs: Any + ) -> _models.AssessmentProjectSummary: + """Get a AssessmentProjectSummary. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param project_summary_name: Group ARM name. Required. + :type project_summary_name: str + :return: AssessmentProjectSummary or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AssessmentProjectSummary + :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.AssessmentProjectSummary] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + project_summary_name=project_summary_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("AssessmentProjectSummary", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessment_projects_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessment_projects_operations_operations.py new file mode 100644 index 000000000000..13a3f2ebbff1 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessment_projects_operations_operations.py @@ -0,0 +1,916 @@ +# 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_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Migrate/assessmentProjects") + 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") + + # 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, **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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # 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, project_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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_request( + resource_group_name: str, project_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-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, project_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-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, project_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class AssessmentProjectsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`assessment_projects_operations` 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_subscription(self, **kwargs: Any) -> Iterable["_models.AssessmentProject"]: + """List AssessmentProject resources by subscription ID. + + :return: An iterator like instance of either AssessmentProject or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.AssessmentProject] + :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.AssessmentProjectListResult] = 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("AssessmentProjectListResult", 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, **kwargs: Any) -> Iterable["_models.AssessmentProject"]: + """List AssessmentProject resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either AssessmentProject or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.AssessmentProject] + :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.AssessmentProjectListResult] = 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, + 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("AssessmentProjectListResult", 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, project_name: str, **kwargs: Any) -> _models.AssessmentProject: + """Get a AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: AssessmentProject or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AssessmentProject + :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.AssessmentProject] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_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("AssessmentProject", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + project_name: str, + resource: Union[_models.AssessmentProject, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "AssessmentProject") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_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["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( + self, + resource_group_name: str, + project_name: str, + resource: _models.AssessmentProject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AssessmentProject]: + """Create a AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.AssessmentProject + :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 AssessmentProject or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.AssessmentProject] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + project_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AssessmentProject]: + """Create a AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AssessmentProject or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.AssessmentProject] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + project_name: str, + resource: Union[_models.AssessmentProject, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.AssessmentProject]: + """Create a AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param resource: Resource create parameters. Is either a AssessmentProject type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.migrationassessment.models.AssessmentProject or IO[bytes] + :return: An instance of LROPoller that returns either AssessmentProject or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.AssessmentProject] + :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.AssessmentProject] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + resource=resource, + 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("AssessmentProject", 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.AssessmentProject].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AssessmentProject]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + project_name: str, + properties: Union[_models.AssessmentProjectUpdate, 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(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "AssessmentProjectUpdate") + + _request = build_update_request( + resource_group_name=resource_group_name, + project_name=project_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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + 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, + project_name: str, + properties: _models.AssessmentProjectUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AssessmentProject]: + """Update a AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.migrationassessment.models.AssessmentProjectUpdate + :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 AssessmentProject or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.AssessmentProject] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + project_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AssessmentProject]: + """Update a AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param properties: The resource properties to be updated. Required. + :type properties: 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 AssessmentProject or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.AssessmentProject] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + project_name: str, + properties: Union[_models.AssessmentProjectUpdate, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.AssessmentProject]: + """Update a AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param properties: The resource properties to be updated. Is either a AssessmentProjectUpdate + type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.migrationassessment.models.AssessmentProjectUpdate or IO[bytes] + :return: An instance of LROPoller that returns either AssessmentProject or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.AssessmentProject] + :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.AssessmentProject] = 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, + project_name=project_name, + properties=properties, + 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("AssessmentProject", 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.AssessmentProject].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AssessmentProject]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> None: + """Delete a AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_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_request( + resource_group_name=resource_group_name, + project_name=project_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/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessments_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessments_operations_operations.py new file mode 100644 index 000000000000..145034fd62b5 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_assessments_operations_operations.py @@ -0,0 +1,847 @@ +# 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 +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +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_group_request( + resource_group_name: str, project_name: str, 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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, + project_name: str, + group_name: str, + assessment_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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_request( + resource_group_name: str, + project_name: str, + group_name: str, + assessment_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-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + project_name: str, + group_name: str, + assessment_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_download_url_request( + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + subscription_id: str, + *, + json: JSON, + **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-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}/downloadUrl", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, json=json, **kwargs) + + +class AssessmentsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`assessments_operations` 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_group( + self, resource_group_name: str, project_name: str, group_name: str, **kwargs: Any + ) -> Iterable["_models.Assessment"]: + """List Assessment resources by Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :return: An iterator like instance of either Assessment or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.Assessment] + :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.AssessmentListResult] = 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_group_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_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("AssessmentListResult", 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, project_name: str, group_name: str, assessment_name: str, **kwargs: Any + ) -> _models.Assessment: + """Get a Assessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Machine Assessment ARM name. Required. + :type assessment_name: str + :return: Assessment or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.Assessment + :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.Assessment] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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("Assessment", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: Union[_models.Assessment, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "Assessment") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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["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( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: _models.Assessment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Assessment]: + """Create a Assessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Machine Assessment ARM name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.Assessment + :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 Assessment or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.Assessment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Assessment]: + """Create a Assessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Machine Assessment ARM name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either Assessment or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.Assessment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: Union[_models.Assessment, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Assessment]: + """Create a Assessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Machine Assessment ARM name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Is either a Assessment type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.migrationassessment.models.Assessment or IO[bytes] + :return: An instance of LROPoller that returns either Assessment or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.Assessment] + :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.Assessment] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + resource=resource, + 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("Assessment", 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.Assessment].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Assessment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, project_name: str, group_name: str, assessment_name: str, **kwargs: Any + ) -> None: + """Delete a Assessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Machine Assessment ARM name. Required. + :type assessment_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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 + + def _download_url_initial( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + body: JSON, + **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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _json = self._serialize.body(body, "object") + + _request = build_download_url_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_download_url( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + body: JSON, + **kwargs: Any + ) -> LROPoller[_models.DownloadUrl]: + """Get download URL for the assessment report. + + Get the URL for downloading the assessment in a report format. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Machine Assessment ARM name. Required. + :type assessment_name: str + :param body: The content of the action request. Required. + :type body: JSON + :return: An instance of LROPoller that returns either DownloadUrl or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.DownloadUrl] + :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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.DownloadUrl] = 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._download_url_initial( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + body=body, + 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("DownloadUrl", 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.DownloadUrl].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DownloadUrl]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_avs_assessed_machines_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_avs_assessed_machines_operations_operations.py new file mode 100644 index 000000000000..21731312694c --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_avs_assessed_machines_operations_operations.py @@ -0,0 +1,342 @@ +# 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_avs_assessment_request( + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: 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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/avsAssessments/{assessmentName}/avsAssessedMachines", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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 continuation_token_parameter is not None: + _params["continuationToken"] = _SERIALIZER.query( + "continuation_token_parameter", continuation_token_parameter, "str" + ) + if total_record_count is not None: + _params["totalRecordCount"] = _SERIALIZER.query("total_record_count", total_record_count, "int") + + # 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, + project_name: str, + group_name: str, + assessment_name: str, + avs_assessed_machine_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/avsAssessments/{assessmentName}/avsAssessedMachines/{avsAssessedMachineName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "avsAssessedMachineName": _SERIALIZER.url( + "avs_assessed_machine_name", avs_assessed_machine_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 AvsAssessedMachinesOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`avs_assessed_machines_operations` 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_avs_assessment( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.AvsAssessedMachine"]: + """List AvsAssessedMachine resources by AvsAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: AVS Assessment ARM name. Required. + :type assessment_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either AvsAssessedMachine or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.AvsAssessedMachine] + :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.AvsAssessedMachineListResult] = 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_avs_assessment_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("AvsAssessedMachineListResult", 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, + project_name: str, + group_name: str, + assessment_name: str, + avs_assessed_machine_name: str, + **kwargs: Any + ) -> _models.AvsAssessedMachine: + """Get a AvsAssessedMachine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: AVS Assessment ARM name. Required. + :type assessment_name: str + :param avs_assessed_machine_name: AVS assessment Assessed Machine ARM name. Required. + :type avs_assessed_machine_name: str + :return: AvsAssessedMachine or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AvsAssessedMachine + :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.AvsAssessedMachine] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + avs_assessed_machine_name=avs_assessed_machine_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("AvsAssessedMachine", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_avs_assessment_options_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_avs_assessment_options_operations_operations.py new file mode 100644 index 000000000000..3c845aeac672 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_avs_assessment_options_operations_operations.py @@ -0,0 +1,275 @@ +# 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_assessment_project_request( + resource_group_name: str, project_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/avsAssessmentOptions", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, project_name: str, avs_assessment_options_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/avsAssessmentOptions/{avsAssessmentOptionsName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "avsAssessmentOptionsName": _SERIALIZER.url( + "avs_assessment_options_name", avs_assessment_options_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 AvsAssessmentOptionsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`avs_assessment_options_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> Iterable["_models.AvsAssessmentOptions"]: + """List AvsAssessmentOptions resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either AvsAssessmentOptions or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.AvsAssessmentOptions] + :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.AvsAssessmentOptionsListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("AvsAssessmentOptionsListResult", 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, project_name: str, avs_assessment_options_name: str, **kwargs: Any + ) -> _models.AvsAssessmentOptions: + """Get a AvsAssessmentOptions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param avs_assessment_options_name: AVS Assessment options ARM name. Accepted value is + 'default'. Required. + :type avs_assessment_options_name: str + :return: AvsAssessmentOptions or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AvsAssessmentOptions + :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.AvsAssessmentOptions] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + avs_assessment_options_name=avs_assessment_options_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("AvsAssessmentOptions", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_avs_assessments_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_avs_assessments_operations_operations.py new file mode 100644 index 000000000000..717a7dad23ac --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_avs_assessments_operations_operations.py @@ -0,0 +1,850 @@ +# 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 +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +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_group_request( + resource_group_name: str, project_name: str, 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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/avsAssessments", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, + project_name: str, + group_name: str, + assessment_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/avsAssessments/{assessmentName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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_request( + resource_group_name: str, + project_name: str, + group_name: str, + assessment_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-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/avsAssessments/{assessmentName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + project_name: str, + group_name: str, + assessment_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/avsAssessments/{assessmentName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_download_url_request( + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + subscription_id: str, + *, + json: JSON, + **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-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/avsAssessments/{assessmentName}/downloadUrl", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, json=json, **kwargs) + + +class AvsAssessmentsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`avs_assessments_operations` 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_group( + self, resource_group_name: str, project_name: str, group_name: str, **kwargs: Any + ) -> Iterable["_models.AvsAssessment"]: + """List AvsAssessment resources by Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :return: An iterator like instance of either AvsAssessment or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.AvsAssessment] + :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.AvsAssessmentListResult] = 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_group_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_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("AvsAssessmentListResult", 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, project_name: str, group_name: str, assessment_name: str, **kwargs: Any + ) -> _models.AvsAssessment: + """Get a AvsAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: AVS Assessment ARM name. Required. + :type assessment_name: str + :return: AvsAssessment or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AvsAssessment + :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.AvsAssessment] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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("AvsAssessment", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: Union[_models.AvsAssessment, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "AvsAssessment") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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["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( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: _models.AvsAssessment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AvsAssessment]: + """Create a AvsAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: AVS Assessment ARM name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.AvsAssessment + :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 AvsAssessment or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.AvsAssessment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AvsAssessment]: + """Create a AvsAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: AVS Assessment ARM name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AvsAssessment or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.AvsAssessment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: Union[_models.AvsAssessment, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.AvsAssessment]: + """Create a AvsAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: AVS Assessment ARM name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Is either a AvsAssessment type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.migrationassessment.models.AvsAssessment or IO[bytes] + :return: An instance of LROPoller that returns either AvsAssessment or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.AvsAssessment] + :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.AvsAssessment] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + resource=resource, + 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("AvsAssessment", 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.AvsAssessment].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AvsAssessment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, project_name: str, group_name: str, assessment_name: str, **kwargs: Any + ) -> None: + """Delete a AvsAssessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: AVS Assessment ARM name. Required. + :type assessment_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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 + + def _download_url_initial( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + body: JSON, + **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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _json = self._serialize.body(body, "object") + + _request = build_download_url_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_download_url( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + body: JSON, + **kwargs: Any + ) -> LROPoller[_models.DownloadUrl]: + """Get download URL for the assessment report. + + Get the URL for downloading the assessment in a report format. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: AVS Assessment ARM name. Required. + :type assessment_name: str + :param body: The content of the action request. Required. + :type body: JSON + :return: An instance of LROPoller that returns either DownloadUrl or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.DownloadUrl] + :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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.DownloadUrl] = 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._download_url_initial( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + body=body, + 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("DownloadUrl", 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.DownloadUrl].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DownloadUrl]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_business_case_avs_summary_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_business_case_avs_summary_operations_operations.py new file mode 100644 index 000000000000..8b3127297449 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_business_case_avs_summary_operations_operations.py @@ -0,0 +1,287 @@ +# 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_business_case_request( + resource_group_name: str, project_name: str, business_case_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/businessCases/{businessCaseName}/avsSummaries", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "businessCaseName": _SERIALIZER.url( + "business_case_name", business_case_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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, + project_name: str, + business_case_name: str, + avs_summary_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/businessCases/{businessCaseName}/avsSummaries/{avsSummaryName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "businessCaseName": _SERIALIZER.url( + "business_case_name", business_case_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + "avsSummaryName": _SERIALIZER.url("avs_summary_name", avs_summary_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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 BusinessCaseAvsSummaryOperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`business_case_avs_summary_operations` 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_business_case( + self, resource_group_name: str, project_name: str, business_case_name: str, **kwargs: Any + ) -> Iterable["_models.AvsSummary"]: + """List AvsSummary resources by BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :return: An iterator like instance of either AvsSummary or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.AvsSummary] + :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.AvsSummaryListResult] = 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_business_case_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_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("AvsSummaryListResult", 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, project_name: str, business_case_name: str, avs_summary_name: str, **kwargs: Any + ) -> _models.AvsSummary: + """Get a AvsSummary. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param avs_summary_name: Gets the Name of the Avs Summary. Required. + :type avs_summary_name: str + :return: AvsSummary or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.AvsSummary + :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.AvsSummary] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + avs_summary_name=avs_summary_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("AvsSummary", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_business_case_iaas_summary_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_business_case_iaas_summary_operations_operations.py new file mode 100644 index 000000000000..a268388f6374 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_business_case_iaas_summary_operations_operations.py @@ -0,0 +1,294 @@ +# 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_business_case_request( + resource_group_name: str, project_name: str, business_case_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/businessCases/{businessCaseName}/iaasSummaries", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "businessCaseName": _SERIALIZER.url( + "business_case_name", business_case_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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, + project_name: str, + business_case_name: str, + iaas_summary_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/businessCases/{businessCaseName}/iaasSummaries/{iaasSummaryName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "businessCaseName": _SERIALIZER.url( + "business_case_name", business_case_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + "iaasSummaryName": _SERIALIZER.url( + "iaas_summary_name", iaas_summary_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 BusinessCaseIaasSummaryOperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`business_case_iaas_summary_operations` 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_business_case( + self, resource_group_name: str, project_name: str, business_case_name: str, **kwargs: Any + ) -> Iterable["_models.IaasSummary"]: + """List IaasSummary resources by BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :return: An iterator like instance of either IaasSummary or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.IaasSummary] + :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.IaasSummaryListResult] = 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_business_case_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_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("IaasSummaryListResult", 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, + project_name: str, + business_case_name: str, + iaas_summary_name: str, + **kwargs: Any + ) -> _models.IaasSummary: + """Get a IaasSummary. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param iaas_summary_name: Gets the Name of the Iaas Summary. Required. + :type iaas_summary_name: str + :return: IaasSummary or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.IaasSummary + :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.IaasSummary] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + iaas_summary_name=iaas_summary_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("IaasSummary", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_business_case_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_business_case_operations_operations.py new file mode 100644 index 000000000000..5e1d14efee18 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_business_case_operations_operations.py @@ -0,0 +1,979 @@ +# 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 +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +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_assessment_project_request( + resource_group_name: str, project_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/businessCases", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, project_name: str, business_case_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/businessCases/{businessCaseName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "businessCaseName": _SERIALIZER.url( + "business_case_name", business_case_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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_request( + resource_group_name: str, project_name: str, business_case_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-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/businessCases/{businessCaseName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "businessCaseName": _SERIALIZER.url( + "business_case_name", business_case_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, project_name: str, business_case_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/businessCases/{businessCaseName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "businessCaseName": _SERIALIZER.url( + "business_case_name", business_case_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_compare_summary_request( + resource_group_name: str, + project_name: str, + business_case_name: str, + subscription_id: str, + *, + json: JSON, + **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-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/businessCases/{businessCaseName}/compareSummary", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "businessCaseName": _SERIALIZER.url( + "business_case_name", business_case_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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, json=json, **kwargs) + + +def build_get_report_download_url_request( + resource_group_name: str, + project_name: str, + business_case_name: str, + subscription_id: str, + *, + json: JSON, + **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-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/businessCases/{businessCaseName}/getReportDownloadUrl", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "businessCaseName": _SERIALIZER.url( + "business_case_name", business_case_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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, json=json, **kwargs) + + +class BusinessCaseOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`business_case_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> Iterable["_models.BusinessCase"]: + """List BusinessCase resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either BusinessCase or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.BusinessCase] + :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.BusinessCaseListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("BusinessCaseListResult", 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, project_name: str, business_case_name: str, **kwargs: Any + ) -> _models.BusinessCase: + """Get a BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :return: BusinessCase or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.BusinessCase + :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.BusinessCase] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_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("BusinessCase", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + project_name: str, + business_case_name: str, + resource: Union[_models.BusinessCase, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "BusinessCase") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_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["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( + self, + resource_group_name: str, + project_name: str, + business_case_name: str, + resource: _models.BusinessCase, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BusinessCase]: + """Create a BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.BusinessCase + :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 BusinessCase or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.BusinessCase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + project_name: str, + business_case_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BusinessCase]: + """Create a BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BusinessCase or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.BusinessCase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + project_name: str, + business_case_name: str, + resource: Union[_models.BusinessCase, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.BusinessCase]: + """Create a BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param resource: Resource create parameters. Is either a BusinessCase type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.migrationassessment.models.BusinessCase or IO[bytes] + :return: An instance of LROPoller that returns either BusinessCase or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.BusinessCase] + :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.BusinessCase] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + resource=resource, + 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("BusinessCase", 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.BusinessCase].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BusinessCase]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, project_name: str, business_case_name: str, **kwargs: Any + ) -> None: + """Delete a BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_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 + + def _compare_summary_initial( + self, resource_group_name: str, project_name: str, business_case_name: str, body: JSON, **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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _json = self._serialize.body(body, "object") + + _request = build_compare_summary_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_compare_summary( + self, resource_group_name: str, project_name: str, business_case_name: str, body: JSON, **kwargs: Any + ) -> LROPoller[_models.CompareSummary]: + """Get Compare summary report for Business case. + + A long-running resource action. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param body: The content of the action request. Required. + :type body: JSON + :return: An instance of LROPoller that returns either CompareSummary or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.CompareSummary] + :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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.CompareSummary] = 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._compare_summary_initial( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + body=body, + 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("CompareSummary", 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.CompareSummary].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CompareSummary]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _get_report_download_url_initial( + self, resource_group_name: str, project_name: str, business_case_name: str, body: JSON, **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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _json = self._serialize.body(body, "object") + + _request = build_get_report_download_url_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_get_report_download_url( + self, resource_group_name: str, project_name: str, business_case_name: str, body: JSON, **kwargs: Any + ) -> LROPoller[_models.ReportDownloadUrl]: + """Get download URL for the business case report. + + Get the URL for downloading the business case in a report format. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param body: The content of the action request. Required. + :type body: JSON + :return: An instance of LROPoller that returns either ReportDownloadUrl or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.ReportDownloadUrl] + :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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.ReportDownloadUrl] = 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._get_report_download_url_initial( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + body=body, + 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("ReportDownloadUrl", 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.ReportDownloadUrl].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ReportDownloadUrl]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_business_case_overview_summary_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_business_case_overview_summary_operations_operations.py new file mode 100644 index 000000000000..010146d62e0d --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_business_case_overview_summary_operations_operations.py @@ -0,0 +1,294 @@ +# 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_business_case_request( + resource_group_name: str, project_name: str, business_case_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/businessCases/{businessCaseName}/overviewSummaries", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "businessCaseName": _SERIALIZER.url( + "business_case_name", business_case_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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, + project_name: str, + business_case_name: str, + overview_summary_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/businessCases/{businessCaseName}/overviewSummaries/{overviewSummaryName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "businessCaseName": _SERIALIZER.url( + "business_case_name", business_case_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + "overviewSummaryName": _SERIALIZER.url( + "overview_summary_name", overview_summary_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 BusinessCaseOverviewSummaryOperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`business_case_overview_summary_operations` 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_business_case( + self, resource_group_name: str, project_name: str, business_case_name: str, **kwargs: Any + ) -> Iterable["_models.OverviewSummary"]: + """List OverviewSummary resources by BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :return: An iterator like instance of either OverviewSummary or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.OverviewSummary] + :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.OverviewSummaryListResult] = 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_business_case_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_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("OverviewSummaryListResult", 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, + project_name: str, + business_case_name: str, + overview_summary_name: str, + **kwargs: Any + ) -> _models.OverviewSummary: + """Get a OverviewSummary. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param overview_summary_name: Gets the Name of the Overview Summary. Required. + :type overview_summary_name: str + :return: OverviewSummary or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.OverviewSummary + :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.OverviewSummary] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + overview_summary_name=overview_summary_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("OverviewSummary", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_business_case_paas_summary_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_business_case_paas_summary_operations_operations.py new file mode 100644 index 000000000000..9f8dfcadc561 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_business_case_paas_summary_operations_operations.py @@ -0,0 +1,294 @@ +# 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_business_case_request( + resource_group_name: str, project_name: str, business_case_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/businessCases/{businessCaseName}/paasSummaries", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "businessCaseName": _SERIALIZER.url( + "business_case_name", business_case_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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, + project_name: str, + business_case_name: str, + paas_summary_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/businessCases/{businessCaseName}/paasSummaries/{paasSummaryName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "businessCaseName": _SERIALIZER.url( + "business_case_name", business_case_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + "paasSummaryName": _SERIALIZER.url( + "paas_summary_name", paas_summary_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 BusinessCasePaasSummaryOperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`business_case_paas_summary_operations` 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_business_case( + self, resource_group_name: str, project_name: str, business_case_name: str, **kwargs: Any + ) -> Iterable["_models.PaasSummary"]: + """List PaasSummary resources by BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :return: An iterator like instance of either PaasSummary or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.PaasSummary] + :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.PaasSummaryListResult] = 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_business_case_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_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("PaasSummaryListResult", 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, + project_name: str, + business_case_name: str, + paas_summary_name: str, + **kwargs: Any + ) -> _models.PaasSummary: + """Get a PaasSummary. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param paas_summary_name: Gets the Name of the Paas Summary. Required. + :type paas_summary_name: str + :return: PaasSummary or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.PaasSummary + :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.PaasSummary] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + paas_summary_name=paas_summary_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("PaasSummary", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_evaluated_avs_machines_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_evaluated_avs_machines_operations_operations.py new file mode 100644 index 000000000000..9eac799af73c --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_evaluated_avs_machines_operations_operations.py @@ -0,0 +1,335 @@ +# 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_business_case_request( + resource_group_name: str, + project_name: str, + business_case_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: 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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/businessCases/{businessCaseName}/evaluatedAvsMachines", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "businessCaseName": _SERIALIZER.url( + "business_case_name", business_case_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 continuation_token_parameter is not None: + _params["continuationToken"] = _SERIALIZER.query( + "continuation_token_parameter", continuation_token_parameter, "str" + ) + if total_record_count is not None: + _params["totalRecordCount"] = _SERIALIZER.query("total_record_count", total_record_count, "int") + + # 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, + project_name: str, + business_case_name: str, + evaluated_avs_machine_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/businessCases/{businessCaseName}/evaluatedAvsMachines/{evaluatedAvsMachineName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "businessCaseName": _SERIALIZER.url( + "business_case_name", business_case_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + "evaluatedAvsMachineName": _SERIALIZER.url( + "evaluated_avs_machine_name", evaluated_avs_machine_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 EvaluatedAvsMachinesOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`evaluated_avs_machines_operations` 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_business_case( + self, + resource_group_name: str, + project_name: str, + business_case_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.EvaluatedAvsMachine"]: + """List EvaluatedAvsMachine resources by BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either EvaluatedAvsMachine or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.EvaluatedAvsMachine] + :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.EvaluatedAvsMachineListResult] = 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_business_case_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("EvaluatedAvsMachineListResult", 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, + project_name: str, + business_case_name: str, + evaluated_avs_machine_name: str, + **kwargs: Any + ) -> _models.EvaluatedAvsMachine: + """Get a EvaluatedAvsMachine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param evaluated_avs_machine_name: Business case Evaluated AVS machine ARM name. Required. + :type evaluated_avs_machine_name: str + :return: EvaluatedAvsMachine or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.EvaluatedAvsMachine + :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.EvaluatedAvsMachine] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + evaluated_avs_machine_name=evaluated_avs_machine_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("EvaluatedAvsMachine", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_evaluated_machines_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_evaluated_machines_operations_operations.py new file mode 100644 index 000000000000..3477a5368d4d --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_evaluated_machines_operations_operations.py @@ -0,0 +1,334 @@ +# 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_business_case_request( + resource_group_name: str, + project_name: str, + business_case_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: 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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/businessCases/{businessCaseName}/evaluatedMachines", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "businessCaseName": _SERIALIZER.url( + "business_case_name", business_case_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 continuation_token_parameter is not None: + _params["continuationToken"] = _SERIALIZER.query( + "continuation_token_parameter", continuation_token_parameter, "str" + ) + if total_record_count is not None: + _params["totalRecordCount"] = _SERIALIZER.query("total_record_count", total_record_count, "int") + + # 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, + project_name: str, + business_case_name: str, + evaluated_machine_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/businessCases/{businessCaseName}/evaluatedMachines/{evaluatedMachineName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "businessCaseName": _SERIALIZER.url( + "business_case_name", business_case_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + "evaluatedMachineName": _SERIALIZER.url( + "evaluated_machine_name", evaluated_machine_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 EvaluatedMachinesOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`evaluated_machines_operations` 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_business_case( + self, + resource_group_name: str, + project_name: str, + business_case_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.EvaluatedMachine"]: + """List EvaluatedMachine resources by BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either EvaluatedMachine or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.EvaluatedMachine] + :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.EvaluatedMachineListResult] = 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_business_case_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("EvaluatedMachineListResult", 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, + project_name: str, + business_case_name: str, + evaluated_machine_name: str, + **kwargs: Any + ) -> _models.EvaluatedMachine: + """Get a EvaluatedMachine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param evaluated_machine_name: Business case Evaluated machine ARM name. Required. + :type evaluated_machine_name: str + :return: EvaluatedMachine or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.EvaluatedMachine + :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.EvaluatedMachine] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + evaluated_machine_name=evaluated_machine_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("EvaluatedMachine", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_evaluated_sql_entities_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_evaluated_sql_entities_operations_operations.py new file mode 100644 index 000000000000..9da94eec6db9 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_evaluated_sql_entities_operations_operations.py @@ -0,0 +1,334 @@ +# 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_business_case_request( + resource_group_name: str, + project_name: str, + business_case_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: 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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/businessCases/{businessCaseName}/evaluatedSqlEntities", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "businessCaseName": _SERIALIZER.url( + "business_case_name", business_case_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 continuation_token_parameter is not None: + _params["continuationToken"] = _SERIALIZER.query( + "continuation_token_parameter", continuation_token_parameter, "str" + ) + if total_record_count is not None: + _params["totalRecordCount"] = _SERIALIZER.query("total_record_count", total_record_count, "int") + + # 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, + project_name: str, + business_case_name: str, + evaluated_sql_entity_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/businessCases/{businessCaseName}/evaluatedSqlEntities/{evaluatedSqlEntityName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "businessCaseName": _SERIALIZER.url( + "business_case_name", business_case_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + "evaluatedSqlEntityName": _SERIALIZER.url( + "evaluated_sql_entity_name", evaluated_sql_entity_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 EvaluatedSqlEntitiesOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`evaluated_sql_entities_operations` 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_business_case( + self, + resource_group_name: str, + project_name: str, + business_case_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.EvaluatedSqlEntity"]: + """List EvaluatedSqlEntity resources by BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either EvaluatedSqlEntity or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.EvaluatedSqlEntity] + :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.EvaluatedSqlEntityListResult] = 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_business_case_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("EvaluatedSqlEntityListResult", 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, + project_name: str, + business_case_name: str, + evaluated_sql_entity_name: str, + **kwargs: Any + ) -> _models.EvaluatedSqlEntity: + """Get a EvaluatedSqlEntity. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param evaluated_sql_entity_name: Business case Evaluated sql entity ARM name. Required. + :type evaluated_sql_entity_name: str + :return: EvaluatedSqlEntity or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.EvaluatedSqlEntity + :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.EvaluatedSqlEntity] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + evaluated_sql_entity_name=evaluated_sql_entity_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("EvaluatedSqlEntity", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_evaluated_web_apps_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_evaluated_web_apps_operations_operations.py new file mode 100644 index 000000000000..373cfa0760cb --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_evaluated_web_apps_operations_operations.py @@ -0,0 +1,334 @@ +# 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_business_case_request( + resource_group_name: str, + project_name: str, + business_case_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: 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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/businessCases/{businessCaseName}/evaluatedWebApps", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "businessCaseName": _SERIALIZER.url( + "business_case_name", business_case_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 continuation_token_parameter is not None: + _params["continuationToken"] = _SERIALIZER.query( + "continuation_token_parameter", continuation_token_parameter, "str" + ) + if total_record_count is not None: + _params["totalRecordCount"] = _SERIALIZER.query("total_record_count", total_record_count, "int") + + # 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, + project_name: str, + business_case_name: str, + evaluated_web_app_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/businessCases/{businessCaseName}/evaluatedWebApps/{evaluatedWebAppName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "businessCaseName": _SERIALIZER.url( + "business_case_name", business_case_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + "evaluatedWebAppName": _SERIALIZER.url( + "evaluated_web_app_name", evaluated_web_app_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 EvaluatedWebAppsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`evaluated_web_apps_operations` 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_business_case( + self, + resource_group_name: str, + project_name: str, + business_case_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.EvaluatedWebApp"]: + """List EvaluatedWebApp resources by BusinessCase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either EvaluatedWebApp or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.EvaluatedWebApp] + :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.EvaluatedWebAppListResult] = 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_business_case_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("EvaluatedWebAppListResult", 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, + project_name: str, + business_case_name: str, + evaluated_web_app_name: str, + **kwargs: Any + ) -> _models.EvaluatedWebApp: + """Get a EvaluatedWebApp. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param business_case_name: Business case ARM name. Required. + :type business_case_name: str + :param evaluated_web_app_name: Business case Evaluated web App ARM name. Required. + :type evaluated_web_app_name: str + :return: EvaluatedWebApp or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.EvaluatedWebApp + :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.EvaluatedWebApp] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + business_case_name=business_case_name, + evaluated_web_app_name=evaluated_web_app_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("EvaluatedWebApp", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_groups_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_groups_operations_operations.py new file mode 100644 index 000000000000..c3e991ce7153 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_groups_operations_operations.py @@ -0,0 +1,861 @@ +# 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_assessment_project_request( + resource_group_name: str, project_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, project_name: str, 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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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_request( + resource_group_name: str, project_name: str, 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-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, project_name: str, 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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_machines_request( + resource_group_name: str, project_name: str, 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-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/updateMachines", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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 GroupsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`groups_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> Iterable["_models.Group"]: + """List Group resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either Group or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.Group] + :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.GroupListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("GroupListResult", 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, project_name: str, group_name: str, **kwargs: Any) -> _models.Group: + """Get a Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :return: Group or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.Group + :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.Group] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=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]: + map_error(status_code=response.status_code, 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("Group", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + project_name: str, + group_name: str, + resource: Union[_models.Group, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "Group") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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["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( + self, + resource_group_name: str, + project_name: str, + group_name: str, + resource: _models.Group, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Group]: + """Create a Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.Group + :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 Group or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.Group] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + project_name: str, + group_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Group]: + """Create a Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either Group or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.Group] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + project_name: str, + group_name: str, + resource: Union[_models.Group, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Group]: + """Create a Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param resource: Resource create parameters. Is either a Group type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.migrationassessment.models.Group or IO[bytes] + :return: An instance of LROPoller that returns either Group or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.Group] + :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.Group] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + resource=resource, + 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("Group", 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.Group].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Group]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, project_name: str, group_name: str, **kwargs: Any + ) -> None: + """Delete a Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=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) + 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 + + def _update_machines_initial( + self, + resource_group_name: str, + project_name: str, + group_name: str, + body: Union[_models.UpdateGroupBody, 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(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "UpdateGroupBody") + + _request = build_update_machines_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + 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_machines( + self, + resource_group_name: str, + project_name: str, + group_name: str, + body: _models.UpdateGroupBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Group]: + """Update machines in group. + + Update machines in group by adding or removing machines. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.migrationassessment.models.UpdateGroupBody + :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 Group or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.Group] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_machines( + self, + resource_group_name: str, + project_name: str, + group_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Group]: + """Update machines in group. + + Update machines in group by adding or removing machines. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param body: The content of the action request. Required. + :type 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: An instance of LROPoller that returns either Group or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.Group] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_machines( + self, + resource_group_name: str, + project_name: str, + group_name: str, + body: Union[_models.UpdateGroupBody, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Group]: + """Update machines in group. + + Update machines in group by adding or removing machines. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param body: The content of the action request. Is either a UpdateGroupBody type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.migrationassessment.models.UpdateGroupBody or IO[bytes] + :return: An instance of LROPoller that returns either Group or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.Group] + :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.Group] = 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_machines_initial( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + body=body, + 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("Group", 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.Group].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Group]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_hyperv_collectors_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_hyperv_collectors_operations_operations.py new file mode 100644 index 000000000000..032754f2a6c3 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_hyperv_collectors_operations_operations.py @@ -0,0 +1,620 @@ +# 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_assessment_project_request( + resource_group_name: str, project_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/hypervcollectors", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, project_name: str, hyperv_collector_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/hypervcollectors/{hypervCollectorName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "hypervCollectorName": _SERIALIZER.url( + "hyperv_collector_name", hyperv_collector_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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_request( + resource_group_name: str, project_name: str, hyperv_collector_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-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/hypervcollectors/{hypervCollectorName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "hypervCollectorName": _SERIALIZER.url( + "hyperv_collector_name", hyperv_collector_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, project_name: str, hyperv_collector_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/hypervcollectors/{hypervCollectorName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "hypervCollectorName": _SERIALIZER.url( + "hyperv_collector_name", hyperv_collector_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class HypervCollectorsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`hyperv_collectors_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> Iterable["_models.HypervCollector"]: + """List HypervCollector resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either HypervCollector or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.HypervCollector] + :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.HypervCollectorListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("HypervCollectorListResult", 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, project_name: str, hyperv_collector_name: str, **kwargs: Any + ) -> _models.HypervCollector: + """Get a HypervCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param hyperv_collector_name: Hyper-V collector ARM name. Required. + :type hyperv_collector_name: str + :return: HypervCollector or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.HypervCollector + :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.HypervCollector] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + hyperv_collector_name=hyperv_collector_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("HypervCollector", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + project_name: str, + hyperv_collector_name: str, + resource: Union[_models.HypervCollector, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "HypervCollector") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + hyperv_collector_name=hyperv_collector_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["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( + self, + resource_group_name: str, + project_name: str, + hyperv_collector_name: str, + resource: _models.HypervCollector, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.HypervCollector]: + """Create a HypervCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param hyperv_collector_name: Hyper-V collector ARM name. Required. + :type hyperv_collector_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.HypervCollector + :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 HypervCollector or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.HypervCollector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + project_name: str, + hyperv_collector_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.HypervCollector]: + """Create a HypervCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param hyperv_collector_name: Hyper-V collector ARM name. Required. + :type hyperv_collector_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either HypervCollector or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.HypervCollector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + project_name: str, + hyperv_collector_name: str, + resource: Union[_models.HypervCollector, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.HypervCollector]: + """Create a HypervCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param hyperv_collector_name: Hyper-V collector ARM name. Required. + :type hyperv_collector_name: str + :param resource: Resource create parameters. Is either a HypervCollector type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.migrationassessment.models.HypervCollector or IO[bytes] + :return: An instance of LROPoller that returns either HypervCollector or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.HypervCollector] + :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.HypervCollector] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + hyperv_collector_name=hyperv_collector_name, + resource=resource, + 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("HypervCollector", 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.HypervCollector].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.HypervCollector]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, project_name: str, hyperv_collector_name: str, **kwargs: Any + ) -> None: + """Delete a HypervCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param hyperv_collector_name: Hyper-V collector ARM name. Required. + :type hyperv_collector_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + hyperv_collector_name=hyperv_collector_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/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_import_collectors_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_import_collectors_operations_operations.py new file mode 100644 index 000000000000..1d2c1d4a0389 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_import_collectors_operations_operations.py @@ -0,0 +1,620 @@ +# 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_assessment_project_request( + resource_group_name: str, project_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/importcollectors", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, project_name: str, import_collector_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/importcollectors/{importCollectorName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "importCollectorName": _SERIALIZER.url( + "import_collector_name", import_collector_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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_request( + resource_group_name: str, project_name: str, import_collector_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-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/importcollectors/{importCollectorName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "importCollectorName": _SERIALIZER.url( + "import_collector_name", import_collector_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, project_name: str, import_collector_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/importcollectors/{importCollectorName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "importCollectorName": _SERIALIZER.url( + "import_collector_name", import_collector_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ImportCollectorsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`import_collectors_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> Iterable["_models.ImportCollector"]: + """List ImportCollector resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either ImportCollector or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.ImportCollector] + :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.ImportCollectorListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("ImportCollectorListResult", 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, project_name: str, import_collector_name: str, **kwargs: Any + ) -> _models.ImportCollector: + """Get a ImportCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param import_collector_name: Import collector ARM name. Required. + :type import_collector_name: str + :return: ImportCollector or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.ImportCollector + :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.ImportCollector] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + import_collector_name=import_collector_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("ImportCollector", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + project_name: str, + import_collector_name: str, + resource: Union[_models.ImportCollector, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "ImportCollector") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + import_collector_name=import_collector_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["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( + self, + resource_group_name: str, + project_name: str, + import_collector_name: str, + resource: _models.ImportCollector, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ImportCollector]: + """Create a ImportCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param import_collector_name: Import collector ARM name. Required. + :type import_collector_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.ImportCollector + :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 ImportCollector or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.ImportCollector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + project_name: str, + import_collector_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ImportCollector]: + """Create a ImportCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param import_collector_name: Import collector ARM name. Required. + :type import_collector_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ImportCollector or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.ImportCollector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + project_name: str, + import_collector_name: str, + resource: Union[_models.ImportCollector, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ImportCollector]: + """Create a ImportCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param import_collector_name: Import collector ARM name. Required. + :type import_collector_name: str + :param resource: Resource create parameters. Is either a ImportCollector type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.migrationassessment.models.ImportCollector or IO[bytes] + :return: An instance of LROPoller that returns either ImportCollector or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.ImportCollector] + :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.ImportCollector] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + import_collector_name=import_collector_name, + resource=resource, + 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("ImportCollector", 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.ImportCollector].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ImportCollector]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, project_name: str, import_collector_name: str, **kwargs: Any + ) -> None: + """Delete a ImportCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param import_collector_name: Import collector ARM name. Required. + :type import_collector_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + import_collector_name=import_collector_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/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_machines_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_machines_operations_operations.py new file mode 100644 index 000000000000..8f4b279ef247 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_machines_operations_operations.py @@ -0,0 +1,306 @@ +# 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_assessment_project_request( + resource_group_name: str, + project_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: 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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/machines", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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 continuation_token_parameter is not None: + _params["continuationToken"] = _SERIALIZER.query( + "continuation_token_parameter", continuation_token_parameter, "str" + ) + if total_record_count is not None: + _params["totalRecordCount"] = _SERIALIZER.query("total_record_count", total_record_count, "int") + + # 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, project_name: str, machine_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/machines/{machineName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "machineName": _SERIALIZER.url("machine_name", machine_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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 MachinesOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`machines_operations` 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_assessment_project( + self, + resource_group_name: str, + project_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.Machine"]: + """List Machine resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either Machine or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.Machine] + :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.MachineListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("MachineListResult", 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, project_name: str, machine_name: str, **kwargs: Any) -> _models.Machine: + """Get a Machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param machine_name: Assessible Machine ARM name. Required. + :type machine_name: str + :return: Machine or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.Machine + :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.Machine] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + machine_name=machine_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("Machine", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_operations.py new file mode 100644 index 000000000000..c0e499e1a36d --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_operations.py @@ -0,0 +1,151 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.Migrate/operations") + + # 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 Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`operations` 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(self, **kwargs: Any) -> Iterable["_models.Operation"]: + """List the operations for the provider. + + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.Operation] + :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.OperationListResult] = 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( + 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("OperationListResult", 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/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_patch.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_private_endpoint_connection_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_private_endpoint_connection_operations_operations.py new file mode 100644 index 000000000000..a68bf681851c --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_private_endpoint_connection_operations_operations.py @@ -0,0 +1,637 @@ +# 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_assessment_project_request( + resource_group_name: str, project_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, + project_name: str, + private_endpoint_connection_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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_update_request( + resource_group_name: str, + project_name: str, + private_endpoint_connection_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-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + project_name: str, + private_endpoint_connection_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class PrivateEndpointConnectionOperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`private_endpoint_connection_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnection"]: + """List PrivateEndpointConnection resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.PrivateEndpointConnection] + :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.PrivateEndpointConnectionListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("PrivateEndpointConnectionListResult", 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, project_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Get a PrivateEndpointConnection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param private_endpoint_connection_name: Private endpoint connection ARM name. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.PrivateEndpointConnection + :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.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_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]: + map_error(status_code=response.status_code, 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("PrivateEndpointConnection", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _update_initial( + self, + resource_group_name: str, + project_name: str, + private_endpoint_connection_name: str, + resource: Union[_models.PrivateEndpointConnection, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "PrivateEndpointConnection") + + _request = build_update_request( + resource_group_name=resource_group_name, + project_name=project_name, + private_endpoint_connection_name=private_endpoint_connection_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["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, + project_name: str, + private_endpoint_connection_name: str, + resource: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Create a PrivateEndpointConnection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param private_endpoint_connection_name: Private endpoint connection ARM name. Required. + :type private_endpoint_connection_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.PrivateEndpointConnection + :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 PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + project_name: str, + private_endpoint_connection_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Create a PrivateEndpointConnection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param private_endpoint_connection_name: Private endpoint connection ARM name. Required. + :type private_endpoint_connection_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + project_name: str, + private_endpoint_connection_name: str, + resource: Union[_models.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Create a PrivateEndpointConnection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param private_endpoint_connection_name: Private endpoint connection ARM name. Required. + :type private_endpoint_connection_name: str + :param resource: Resource create parameters. Is either a PrivateEndpointConnection type or a + IO[bytes] type. Required. + :type resource: ~azure.mgmt.migrationassessment.models.PrivateEndpointConnection or IO[bytes] + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.PrivateEndpointConnection] + :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.PrivateEndpointConnection] = 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, + project_name=project_name, + private_endpoint_connection_name=private_endpoint_connection_name, + resource=resource, + 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("PrivateEndpointConnection", 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.PrivateEndpointConnection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, project_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> None: + """Delete a PrivateEndpointConnection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param private_endpoint_connection_name: Private endpoint connection ARM name. 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_request( + resource_group_name=resource_group_name, + project_name=project_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/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_private_link_resource_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_private_link_resource_operations_operations.py new file mode 100644 index 000000000000..9cc44825ef2a --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_private_link_resource_operations_operations.py @@ -0,0 +1,273 @@ +# 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_assessment_project_request( + resource_group_name: str, project_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, project_name: str, private_link_resource_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/privateLinkResources/{privateLinkResourceName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "privateLinkResourceName": _SERIALIZER.url( + "private_link_resource_name", private_link_resource_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 PrivateLinkResourceOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`private_link_resource_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateLinkResource"]: + """List PrivateLinkResource resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.PrivateLinkResource] + :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.PrivateLinkResourceListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("PrivateLinkResourceListResult", 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, project_name: str, private_link_resource_name: str, **kwargs: Any + ) -> _models.PrivateLinkResource: + """Get a PrivateLinkResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param private_link_resource_name: Private link resource ARM name. Required. + :type private_link_resource_name: str + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.PrivateLinkResource + :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.PrivateLinkResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + private_link_resource_name=private_link_resource_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("PrivateLinkResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_server_collectors_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_server_collectors_operations_operations.py new file mode 100644 index 000000000000..9ed311625b04 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_server_collectors_operations_operations.py @@ -0,0 +1,620 @@ +# 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_assessment_project_request( + resource_group_name: str, project_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/servercollectors", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, project_name: str, server_collector_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/servercollectors/{serverCollectorName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "serverCollectorName": _SERIALIZER.url( + "server_collector_name", server_collector_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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_request( + resource_group_name: str, project_name: str, server_collector_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-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/servercollectors/{serverCollectorName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "serverCollectorName": _SERIALIZER.url( + "server_collector_name", server_collector_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, project_name: str, server_collector_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/servercollectors/{serverCollectorName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "serverCollectorName": _SERIALIZER.url( + "server_collector_name", server_collector_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ServerCollectorsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`server_collectors_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> Iterable["_models.ServerCollector"]: + """List ServerCollector resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either ServerCollector or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.ServerCollector] + :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.ServerCollectorListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("ServerCollectorListResult", 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, project_name: str, server_collector_name: str, **kwargs: Any + ) -> _models.ServerCollector: + """Get a ServerCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param server_collector_name: Physical server collector ARM name. Required. + :type server_collector_name: str + :return: ServerCollector or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.ServerCollector + :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.ServerCollector] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + server_collector_name=server_collector_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("ServerCollector", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + project_name: str, + server_collector_name: str, + resource: Union[_models.ServerCollector, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "ServerCollector") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + server_collector_name=server_collector_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["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( + self, + resource_group_name: str, + project_name: str, + server_collector_name: str, + resource: _models.ServerCollector, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServerCollector]: + """Create a ServerCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param server_collector_name: Physical server collector ARM name. Required. + :type server_collector_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.ServerCollector + :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 ServerCollector or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.ServerCollector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + project_name: str, + server_collector_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServerCollector]: + """Create a ServerCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param server_collector_name: Physical server collector ARM name. Required. + :type server_collector_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ServerCollector or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.ServerCollector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + project_name: str, + server_collector_name: str, + resource: Union[_models.ServerCollector, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ServerCollector]: + """Create a ServerCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param server_collector_name: Physical server collector ARM name. Required. + :type server_collector_name: str + :param resource: Resource create parameters. Is either a ServerCollector type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.migrationassessment.models.ServerCollector or IO[bytes] + :return: An instance of LROPoller that returns either ServerCollector or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.ServerCollector] + :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.ServerCollector] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + server_collector_name=server_collector_name, + resource=resource, + 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("ServerCollector", 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.ServerCollector].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ServerCollector]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, project_name: str, server_collector_name: str, **kwargs: Any + ) -> None: + """Delete a ServerCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param server_collector_name: Physical server collector ARM name. Required. + :type server_collector_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + server_collector_name=server_collector_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/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_sql_assessment_options_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_sql_assessment_options_operations_operations.py new file mode 100644 index 000000000000..8da5864ff293 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_sql_assessment_options_operations_operations.py @@ -0,0 +1,275 @@ +# 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_assessment_project_request( + resource_group_name: str, project_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/sqlAssessmentOptions", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, project_name: str, assessment_options_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/sqlAssessmentOptions/{assessmentOptionsName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentOptionsName": _SERIALIZER.url( + "assessment_options_name", assessment_options_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 SqlAssessmentOptionsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`sql_assessment_options_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> Iterable["_models.SqlAssessmentOptions"]: + """List SqlAssessmentOptions resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either SqlAssessmentOptions or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.SqlAssessmentOptions] + :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.SqlAssessmentOptionsListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("SqlAssessmentOptionsListResult", 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, project_name: str, assessment_options_name: str, **kwargs: Any + ) -> _models.SqlAssessmentOptions: + """Get a SqlAssessmentOptions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_options_name: Sql assessment options ARM name. Accepted values is 'default'. + Required. + :type assessment_options_name: str + :return: SqlAssessmentOptions or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.SqlAssessmentOptions + :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.SqlAssessmentOptions] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_options_name=assessment_options_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("SqlAssessmentOptions", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_sql_assessment_v2_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_sql_assessment_v2_operations_operations.py new file mode 100644 index 000000000000..b15100467628 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_sql_assessment_v2_operations_operations.py @@ -0,0 +1,850 @@ +# 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 +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +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_group_request( + resource_group_name: str, project_name: str, 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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/sqlAssessments", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, + project_name: str, + group_name: str, + assessment_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/sqlAssessments/{assessmentName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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_request( + resource_group_name: str, + project_name: str, + group_name: str, + assessment_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-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/sqlAssessments/{assessmentName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + project_name: str, + group_name: str, + assessment_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/sqlAssessments/{assessmentName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_download_url_request( + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + subscription_id: str, + *, + json: JSON, + **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-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/sqlAssessments/{assessmentName}/downloadUrl", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, json=json, **kwargs) + + +class SqlAssessmentV2OperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`sql_assessment_v2_operations` 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_group( + self, resource_group_name: str, project_name: str, group_name: str, **kwargs: Any + ) -> Iterable["_models.SqlAssessmentV2"]: + """List SqlAssessmentV2 resources by Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :return: An iterator like instance of either SqlAssessmentV2 or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.SqlAssessmentV2] + :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.SqlAssessmentV2ListResult] = 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_group_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_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("SqlAssessmentV2ListResult", 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, project_name: str, group_name: str, assessment_name: str, **kwargs: Any + ) -> _models.SqlAssessmentV2: + """Get a SqlAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :return: SqlAssessmentV2 or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.SqlAssessmentV2 + :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.SqlAssessmentV2] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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("SqlAssessmentV2", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: Union[_models.SqlAssessmentV2, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "SqlAssessmentV2") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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["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( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: _models.SqlAssessmentV2, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SqlAssessmentV2]: + """Create a SqlAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.SqlAssessmentV2 + :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 SqlAssessmentV2 or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.SqlAssessmentV2] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SqlAssessmentV2]: + """Create a SqlAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either SqlAssessmentV2 or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.SqlAssessmentV2] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: Union[_models.SqlAssessmentV2, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.SqlAssessmentV2]: + """Create a SqlAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Is either a SqlAssessmentV2 type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.migrationassessment.models.SqlAssessmentV2 or IO[bytes] + :return: An instance of LROPoller that returns either SqlAssessmentV2 or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.SqlAssessmentV2] + :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.SqlAssessmentV2] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + resource=resource, + 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("SqlAssessmentV2", 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.SqlAssessmentV2].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.SqlAssessmentV2]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, project_name: str, group_name: str, assessment_name: str, **kwargs: Any + ) -> None: + """Delete a SqlAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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 + + def _download_url_initial( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + body: JSON, + **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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _json = self._serialize.body(body, "object") + + _request = build_download_url_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_download_url( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + body: JSON, + **kwargs: Any + ) -> LROPoller[_models.DownloadUrl]: + """Get download URL for the assessment report. + + Get the URL for downloading the assessment in a report format. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param body: The content of the action request. Required. + :type body: JSON + :return: An instance of LROPoller that returns either DownloadUrl or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.DownloadUrl] + :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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.DownloadUrl] = 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._download_url_initial( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + body=body, + 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("DownloadUrl", 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.DownloadUrl].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DownloadUrl]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_sql_assessment_v2_summary_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_sql_assessment_v2_summary_operations_operations.py new file mode 100644 index 000000000000..bc0bb4a4ec8b --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_sql_assessment_v2_summary_operations_operations.py @@ -0,0 +1,305 @@ +# 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_sql_assessment_v2_request( + resource_group_name: str, + project_name: str, + group_name: str, + assessment_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/sqlAssessments/{assessmentName}/summaries", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, + project_name: str, + group_name: str, + assessment_name: str, + summary_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/sqlAssessments/{assessmentName}/summaries/{summaryName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "summaryName": _SERIALIZER.url("summary_name", summary_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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 SqlAssessmentV2SummaryOperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`sql_assessment_v2_summary_operations` 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_sql_assessment_v2( + self, resource_group_name: str, project_name: str, group_name: str, assessment_name: str, **kwargs: Any + ) -> Iterable["_models.SqlAssessmentV2Summary"]: + """List SqlAssessmentV2Summary resources by SqlAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :return: An iterator like instance of either SqlAssessmentV2Summary or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.SqlAssessmentV2Summary] + :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.SqlAssessmentV2SummaryListResult] = 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_sql_assessment_v2_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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("SqlAssessmentV2SummaryListResult", 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, + project_name: str, + group_name: str, + assessment_name: str, + summary_name: str, + **kwargs: Any + ) -> _models.SqlAssessmentV2Summary: + """Get a SqlAssessmentV2Summary. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: SQL Assessment arm name. Required. + :type assessment_name: str + :param summary_name: Gets the Name of the SQL Summary. Required. + :type summary_name: str + :return: SqlAssessmentV2Summary or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.SqlAssessmentV2Summary + :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.SqlAssessmentV2Summary] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + summary_name=summary_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("SqlAssessmentV2Summary", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_sql_collector_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_sql_collector_operations_operations.py new file mode 100644 index 000000000000..d0e5c061b9c3 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_sql_collector_operations_operations.py @@ -0,0 +1,614 @@ +# 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_assessment_project_request( + resource_group_name: str, project_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/sqlcollectors", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, project_name: str, collector_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/sqlcollectors/{collectorName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "collectorName": _SERIALIZER.url("collector_name", collector_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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_request( + resource_group_name: str, project_name: str, collector_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-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/sqlcollectors/{collectorName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "collectorName": _SERIALIZER.url("collector_name", collector_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, project_name: str, collector_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/sqlcollectors/{collectorName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "collectorName": _SERIALIZER.url("collector_name", collector_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class SqlCollectorOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`sql_collector_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> Iterable["_models.SqlCollector"]: + """List SqlCollector resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either SqlCollector or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.SqlCollector] + :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.SqlCollectorListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("SqlCollectorListResult", 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, project_name: str, collector_name: str, **kwargs: Any + ) -> _models.SqlCollector: + """Get a SqlCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param collector_name: Sql collector ARM name. Required. + :type collector_name: str + :return: SqlCollector or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.SqlCollector + :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.SqlCollector] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + collector_name=collector_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("SqlCollector", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + project_name: str, + collector_name: str, + resource: Union[_models.SqlCollector, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "SqlCollector") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + collector_name=collector_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["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( + self, + resource_group_name: str, + project_name: str, + collector_name: str, + resource: _models.SqlCollector, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SqlCollector]: + """Create a SqlCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param collector_name: Sql collector ARM name. Required. + :type collector_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.SqlCollector + :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 SqlCollector or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.SqlCollector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + project_name: str, + collector_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SqlCollector]: + """Create a SqlCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param collector_name: Sql collector ARM name. Required. + :type collector_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either SqlCollector or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.SqlCollector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + project_name: str, + collector_name: str, + resource: Union[_models.SqlCollector, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.SqlCollector]: + """Create a SqlCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param collector_name: Sql collector ARM name. Required. + :type collector_name: str + :param resource: Resource create parameters. Is either a SqlCollector type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.migrationassessment.models.SqlCollector or IO[bytes] + :return: An instance of LROPoller that returns either SqlCollector or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.SqlCollector] + :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.SqlCollector] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + collector_name=collector_name, + resource=resource, + 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("SqlCollector", 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.SqlCollector].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.SqlCollector]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, project_name: str, collector_name: str, **kwargs: Any + ) -> None: + """Delete a SqlCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param collector_name: Sql collector ARM name. Required. + :type collector_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + collector_name=collector_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/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_vmware_collectors_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_vmware_collectors_operations_operations.py new file mode 100644 index 000000000000..1dfeaccae035 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_vmware_collectors_operations_operations.py @@ -0,0 +1,620 @@ +# 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_assessment_project_request( + resource_group_name: str, project_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/vmwarecollectors", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, project_name: str, vm_ware_collector_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/vmwarecollectors/{vmWareCollectorName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "vmWareCollectorName": _SERIALIZER.url( + "vm_ware_collector_name", vm_ware_collector_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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_request( + resource_group_name: str, project_name: str, vm_ware_collector_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-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/vmwarecollectors/{vmWareCollectorName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "vmWareCollectorName": _SERIALIZER.url( + "vm_ware_collector_name", vm_ware_collector_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, project_name: str, vm_ware_collector_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/vmwarecollectors/{vmWareCollectorName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "vmWareCollectorName": _SERIALIZER.url( + "vm_ware_collector_name", vm_ware_collector_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class VmwareCollectorsOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`vmware_collectors_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> Iterable["_models.VmwareCollector"]: + """List VmwareCollector resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either VmwareCollector or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.VmwareCollector] + :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.VmwareCollectorListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("VmwareCollectorListResult", 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, project_name: str, vm_ware_collector_name: str, **kwargs: Any + ) -> _models.VmwareCollector: + """Get a VmwareCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param vm_ware_collector_name: VMware collector ARM name. Required. + :type vm_ware_collector_name: str + :return: VmwareCollector or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.VmwareCollector + :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.VmwareCollector] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + vm_ware_collector_name=vm_ware_collector_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("VmwareCollector", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + project_name: str, + vm_ware_collector_name: str, + resource: Union[_models.VmwareCollector, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "VmwareCollector") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + vm_ware_collector_name=vm_ware_collector_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["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( + self, + resource_group_name: str, + project_name: str, + vm_ware_collector_name: str, + resource: _models.VmwareCollector, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VmwareCollector]: + """Create a VmwareCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param vm_ware_collector_name: VMware collector ARM name. Required. + :type vm_ware_collector_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.VmwareCollector + :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 VmwareCollector or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.VmwareCollector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + project_name: str, + vm_ware_collector_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VmwareCollector]: + """Create a VmwareCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param vm_ware_collector_name: VMware collector ARM name. Required. + :type vm_ware_collector_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either VmwareCollector or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.VmwareCollector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + project_name: str, + vm_ware_collector_name: str, + resource: Union[_models.VmwareCollector, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.VmwareCollector]: + """Create a VmwareCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param vm_ware_collector_name: VMware collector ARM name. Required. + :type vm_ware_collector_name: str + :param resource: Resource create parameters. Is either a VmwareCollector type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.migrationassessment.models.VmwareCollector or IO[bytes] + :return: An instance of LROPoller that returns either VmwareCollector or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.VmwareCollector] + :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.VmwareCollector] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + vm_ware_collector_name=vm_ware_collector_name, + resource=resource, + 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("VmwareCollector", 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.VmwareCollector].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.VmwareCollector]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, project_name: str, vm_ware_collector_name: str, **kwargs: Any + ) -> None: + """Delete a VmwareCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param vm_ware_collector_name: VMware collector ARM name. Required. + :type vm_ware_collector_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + vm_ware_collector_name=vm_ware_collector_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/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_web_app_assessment_options_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_web_app_assessment_options_operations_operations.py new file mode 100644 index 000000000000..c09ffd4d35dc --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_web_app_assessment_options_operations_operations.py @@ -0,0 +1,275 @@ +# 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_assessment_project_request( + resource_group_name: str, project_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/webAppAssessmentOptions", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, project_name: str, assessment_options_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/webAppAssessmentOptions/{assessmentOptionsName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentOptionsName": _SERIALIZER.url( + "assessment_options_name", assessment_options_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 WebAppAssessmentOptionsOperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`web_app_assessment_options_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> Iterable["_models.WebAppAssessmentOptions"]: + """List WebAppAssessmentOptions resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either WebAppAssessmentOptions or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.WebAppAssessmentOptions] + :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.WebAppAssessmentOptionsListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("WebAppAssessmentOptionsListResult", 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, project_name: str, assessment_options_name: str, **kwargs: Any + ) -> _models.WebAppAssessmentOptions: + """Get a WebAppAssessmentOptions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param assessment_options_name: Web app assessment options ARM name. Accepted values is + 'default'. Required. + :type assessment_options_name: str + :return: WebAppAssessmentOptions or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.WebAppAssessmentOptions + :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.WebAppAssessmentOptions] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + assessment_options_name=assessment_options_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("WebAppAssessmentOptions", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_web_app_assessment_v2_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_web_app_assessment_v2_operations_operations.py new file mode 100644 index 000000000000..c7374a32a363 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_web_app_assessment_v2_operations_operations.py @@ -0,0 +1,853 @@ +# 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 +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +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_group_request( + resource_group_name: str, project_name: str, 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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/webAppAssessments", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, + project_name: str, + group_name: str, + assessment_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/webAppAssessments/{assessmentName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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_request( + resource_group_name: str, + project_name: str, + group_name: str, + assessment_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-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/webAppAssessments/{assessmentName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + project_name: str, + group_name: str, + assessment_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/webAppAssessments/{assessmentName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_download_url_request( + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + subscription_id: str, + *, + json: JSON, + **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-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/webAppAssessments/{assessmentName}/downloadUrl", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, json=json, **kwargs) + + +class WebAppAssessmentV2OperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`web_app_assessment_v2_operations` 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_group( + self, resource_group_name: str, project_name: str, group_name: str, **kwargs: Any + ) -> Iterable["_models.WebAppAssessmentV2"]: + """List WebAppAssessmentV2 resources by Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :return: An iterator like instance of either WebAppAssessmentV2 or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.WebAppAssessmentV2] + :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.WebAppAssessmentV2ListResult] = 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_group_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_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("WebAppAssessmentV2ListResult", 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, project_name: str, group_name: str, assessment_name: str, **kwargs: Any + ) -> _models.WebAppAssessmentV2: + """Get a WebAppAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Web app Assessment arm name. Required. + :type assessment_name: str + :return: WebAppAssessmentV2 or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.WebAppAssessmentV2 + :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.WebAppAssessmentV2] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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("WebAppAssessmentV2", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: Union[_models.WebAppAssessmentV2, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "WebAppAssessmentV2") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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["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( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: _models.WebAppAssessmentV2, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.WebAppAssessmentV2]: + """Create a WebAppAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Web app Assessment arm name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.WebAppAssessmentV2 + :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 WebAppAssessmentV2 or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.WebAppAssessmentV2] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.WebAppAssessmentV2]: + """Create a WebAppAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Web app Assessment arm name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either WebAppAssessmentV2 or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.WebAppAssessmentV2] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + resource: Union[_models.WebAppAssessmentV2, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.WebAppAssessmentV2]: + """Create a WebAppAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Web app Assessment arm name. Required. + :type assessment_name: str + :param resource: Resource create parameters. Is either a WebAppAssessmentV2 type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.migrationassessment.models.WebAppAssessmentV2 or IO[bytes] + :return: An instance of LROPoller that returns either WebAppAssessmentV2 or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.WebAppAssessmentV2] + :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.WebAppAssessmentV2] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + resource=resource, + 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("WebAppAssessmentV2", 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.WebAppAssessmentV2].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.WebAppAssessmentV2]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, project_name: str, group_name: str, assessment_name: str, **kwargs: Any + ) -> None: + """Delete a WebAppAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Web app Assessment arm name. Required. + :type assessment_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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 + + def _download_url_initial( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + body: JSON, + **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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _json = self._serialize.body(body, "object") + + _request = build_download_url_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_download_url( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + body: JSON, + **kwargs: Any + ) -> LROPoller[_models.DownloadUrl]: + """Get download URL for the assessment report. + + Get the URL for downloading the assessment in a report format. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Web app Assessment arm name. Required. + :type assessment_name: str + :param body: The content of the action request. Required. + :type body: JSON + :return: An instance of LROPoller that returns either DownloadUrl or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.DownloadUrl] + :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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.DownloadUrl] = 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._download_url_initial( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + body=body, + 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("DownloadUrl", 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.DownloadUrl].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DownloadUrl]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_web_app_assessment_v2_summary_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_web_app_assessment_v2_summary_operations_operations.py new file mode 100644 index 000000000000..e0db5e2d7948 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_web_app_assessment_v2_summary_operations_operations.py @@ -0,0 +1,305 @@ +# 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_web_app_assessment_v2_request( # pylint: disable=name-too-long + resource_group_name: str, + project_name: str, + group_name: str, + assessment_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/webAppAssessments/{assessmentName}/summaries", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, + project_name: str, + group_name: str, + assessment_name: str, + summary_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/webAppAssessments/{assessmentName}/summaries/{summaryName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "summaryName": _SERIALIZER.url("summary_name", summary_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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 WebAppAssessmentV2SummaryOperationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`web_app_assessment_v2_summary_operations` 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_web_app_assessment_v2( + self, resource_group_name: str, project_name: str, group_name: str, assessment_name: str, **kwargs: Any + ) -> Iterable["_models.WebAppAssessmentV2Summary"]: + """List WebAppAssessmentV2Summary resources by WebAppAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Web app Assessment arm name. Required. + :type assessment_name: str + :return: An iterator like instance of either WebAppAssessmentV2Summary or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.WebAppAssessmentV2Summary] + :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.WebAppAssessmentV2SummaryListResult] = 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_web_app_assessment_v2_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_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("WebAppAssessmentV2SummaryListResult", 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, + project_name: str, + group_name: str, + assessment_name: str, + summary_name: str, + **kwargs: Any + ) -> _models.WebAppAssessmentV2Summary: + """Get a WebAppAssessmentV2Summary. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Web app Assessment arm name. Required. + :type assessment_name: str + :param summary_name: Gets the Name of the Web app Summary. Required. + :type summary_name: str + :return: WebAppAssessmentV2Summary or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.WebAppAssessmentV2Summary + :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.WebAppAssessmentV2Summary] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + summary_name=summary_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("WebAppAssessmentV2Summary", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_web_app_collector_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_web_app_collector_operations_operations.py new file mode 100644 index 000000000000..43fa943cc80f --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_web_app_collector_operations_operations.py @@ -0,0 +1,614 @@ +# 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_assessment_project_request( + resource_group_name: str, project_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/webAppCollectors", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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, project_name: str, collector_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/webAppCollectors/{collectorName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "collectorName": _SERIALIZER.url("collector_name", collector_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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_request( + resource_group_name: str, project_name: str, collector_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-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/webAppCollectors/{collectorName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "collectorName": _SERIALIZER.url("collector_name", collector_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, project_name: str, collector_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/webAppCollectors/{collectorName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "collectorName": _SERIALIZER.url("collector_name", collector_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class WebAppCollectorOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`web_app_collector_operations` 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_assessment_project( + self, resource_group_name: str, project_name: str, **kwargs: Any + ) -> Iterable["_models.WebAppCollector"]: + """List WebAppCollector resources by AssessmentProject. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :return: An iterator like instance of either WebAppCollector or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.WebAppCollector] + :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.WebAppCollectorListResult] = 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_assessment_project_request( + resource_group_name=resource_group_name, + project_name=project_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("WebAppCollectorListResult", 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, project_name: str, collector_name: str, **kwargs: Any + ) -> _models.WebAppCollector: + """Get a WebAppCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param collector_name: Web app collector ARM name. Required. + :type collector_name: str + :return: WebAppCollector or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.WebAppCollector + :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.WebAppCollector] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + collector_name=collector_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("WebAppCollector", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + project_name: str, + collector_name: str, + resource: Union[_models.WebAppCollector, 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(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "WebAppCollector") + + _request = build_create_request( + resource_group_name=resource_group_name, + project_name=project_name, + collector_name=collector_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["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( + self, + resource_group_name: str, + project_name: str, + collector_name: str, + resource: _models.WebAppCollector, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.WebAppCollector]: + """Create a WebAppCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param collector_name: Web app collector ARM name. Required. + :type collector_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.migrationassessment.models.WebAppCollector + :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 WebAppCollector or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.WebAppCollector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + project_name: str, + collector_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.WebAppCollector]: + """Create a WebAppCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param collector_name: Web app collector ARM name. Required. + :type collector_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either WebAppCollector or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.WebAppCollector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + project_name: str, + collector_name: str, + resource: Union[_models.WebAppCollector, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.WebAppCollector]: + """Create a WebAppCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param collector_name: Web app collector ARM name. Required. + :type collector_name: str + :param resource: Resource create parameters. Is either a WebAppCollector type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.migrationassessment.models.WebAppCollector or IO[bytes] + :return: An instance of LROPoller that returns either WebAppCollector or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.migrationassessment.models.WebAppCollector] + :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.WebAppCollector] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + project_name=project_name, + collector_name=collector_name, + resource=resource, + 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("WebAppCollector", 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.WebAppCollector].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.WebAppCollector]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, project_name: str, collector_name: str, **kwargs: Any + ) -> None: + """Delete a WebAppCollector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param collector_name: Web app collector ARM name. Required. + :type collector_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_request( + resource_group_name=resource_group_name, + project_name=project_name, + collector_name=collector_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/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_web_app_service_plan_v2_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_web_app_service_plan_v2_operations_operations.py new file mode 100644 index 000000000000..3991a9c676b6 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/operations/_web_app_service_plan_v2_operations_operations.py @@ -0,0 +1,343 @@ +# 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_web_app_assessment_v2_request( # pylint: disable=name-too-long + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: 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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/webAppAssessments/{assessmentName}/webAppServicePlans", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + } + + _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 continuation_token_parameter is not None: + _params["continuationToken"] = _SERIALIZER.query( + "continuation_token_parameter", continuation_token_parameter, "str" + ) + if total_record_count is not None: + _params["totalRecordCount"] = _SERIALIZER.query("total_record_count", total_record_count, "int") + + # 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, + project_name: str, + group_name: str, + assessment_name: str, + web_app_service_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-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/webAppAssessments/{assessmentName}/webAppServicePlans/{webAppServicePlanName}", + ) # 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 + ), + "projectName": _SERIALIZER.url("project_name", project_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$"), + "webAppServicePlanName": _SERIALIZER.url( + "web_app_service_plan_name", web_app_service_plan_name, "str", pattern=r"^[^<>&:\?/#]{1,260}$" + ), + } + + _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 WebAppServicePlanV2OperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.migrationassessment.AzureMigrateAssessmentService`'s + :attr:`web_app_service_plan_v2_operations` 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_web_app_assessment_v2( + self, + resource_group_name: str, + project_name: str, + group_name: str, + assessment_name: str, + filter: Optional[str] = None, + page_size: Optional[int] = None, + continuation_token_parameter: Optional[str] = None, + total_record_count: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.WebAppServicePlanV2"]: + """List WebAppServicePlanV2 resources by WebAppAssessmentV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Web app Assessment arm name. Required. + :type assessment_name: str + :param filter: Filter query. Default value is None. + :type filter: str + :param page_size: Optional parameter for page size. Default value is None. + :type page_size: int + :param continuation_token_parameter: Optional parameter for continuation token. Default value + is None. + :type continuation_token_parameter: str + :param total_record_count: Total record count. Default value is None. + :type total_record_count: int + :return: An iterator like instance of either WebAppServicePlanV2 or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.migrationassessment.models.WebAppServicePlanV2] + :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.WebAppServicePlanV2ListResult] = 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_web_app_assessment_v2_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + subscription_id=self._config.subscription_id, + filter=filter, + page_size=page_size, + continuation_token_parameter=continuation_token_parameter, + total_record_count=total_record_count, + 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("WebAppServicePlanV2ListResult", 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, + project_name: str, + group_name: str, + assessment_name: str, + web_app_service_plan_name: str, + **kwargs: Any + ) -> _models.WebAppServicePlanV2: + """Get a WebAppServicePlanV2. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param project_name: Assessment Project Name. Required. + :type project_name: str + :param group_name: Group ARM name. Required. + :type group_name: str + :param assessment_name: Web app Assessment arm name. Required. + :type assessment_name: str + :param web_app_service_plan_name: Web app service plan ARM name. Required. + :type web_app_service_plan_name: str + :return: WebAppServicePlanV2 or the result of cls(response) + :rtype: ~azure.mgmt.migrationassessment.models.WebAppServicePlanV2 + :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.WebAppServicePlanV2] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + project_name=project_name, + group_name=group_name, + assessment_name=assessment_name, + web_app_service_plan_name=web_app_service_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("WebAppServicePlanV2", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/py.typed b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/azure/mgmt/migrationassessment/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_assessment_operations_create_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_assessment_operations_create_maximum_set_gen.py new file mode 100644 index 000000000000..037c04785580 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_assessment_operations_create_maximum_set_gen.py @@ -0,0 +1,69 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python aks_assessment_operations_create_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="D6F60DF4-CE70-4E39-8217-B8FBE7CA85AA", + ) + + response = client.aks_assessment_operations.begin_create( + resource_group_name="rgaksswagger", + project_name="testproject", + assessment_name="testaksassessment", + resource={ + "properties": { + "scope": { + "serverGroupId": "/subscriptions/D6F60DF4-CE70-4E39-8217-B8FBE7CA85AA/resourceGroups/rgaksswagger/providers/Microsoft.Migrate/assessmentProjects/testproject/groups/testgrp" + }, + "settings": { + "azureLocation": "Unknown", + "category": "All", + "consolidation": "Full", + "currency": "Unknown", + "discountPercentage": 15, + "environmentType": "Unknown", + "licensingProgram": "Default", + "performanceData": { + "percentile": "Percentile50", + "perfDataEndTime": "2023-11-07T06:51:24.320Z", + "perfDataStartTime": "2023-11-07T06:51:24.320Z", + "timeRange": "Day", + }, + "pricingTier": "Standard", + "savingsOptions": "None", + "scalingFactor": 3, + "sizingCriteria": "PerformanceBased", + }, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AksAssessmentOperations_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_assessment_operations_delete_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_assessment_operations_delete_maximum_set_gen.py new file mode 100644 index 000000000000..03803b316aec --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_assessment_operations_delete_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python aks_assessment_operations_delete_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="D6F60DF4-CE70-4E39-8217-B8FBE7CA85AA", + ) + + client.aks_assessment_operations.delete( + resource_group_name="rgaksswagger", + project_name="testproject", + assessment_name="testaksassessment", + ) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AksAssessmentOperations_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_assessment_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_assessment_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..37df2eaed4e2 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_assessment_operations_get_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python aks_assessment_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="D6F60DF4-CE70-4E39-8217-B8FBE7CA85AA", + ) + + response = client.aks_assessment_operations.get( + resource_group_name="rgaksswagger", + project_name="testproject", + assessment_name="testaksassessment", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AksAssessmentOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_assessment_operations_list_by_assessment_project_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_assessment_operations_list_by_assessment_project_maximum_set_gen.py new file mode 100644 index 000000000000..a9ad349fb7b2 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_assessment_operations_list_by_assessment_project_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python aks_assessment_operations_list_by_assessment_project_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="D6F60DF4-CE70-4E39-8217-B8FBE7CA85AA", + ) + + response = client.aks_assessment_operations.list_by_assessment_project( + resource_group_name="rgaksswagger", + project_name="testproject", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AksAssessmentOperations_ListByAssessmentProject_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_cluster_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_cluster_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..d935a9e7e266 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_cluster_operations_get_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python aks_cluster_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="D6F60DF4-CE70-4E39-8217-B8FBE7CA85AA", + ) + + response = client.aks_cluster_operations.get( + resource_group_name="rgaksswagger", + project_name="testproject", + assessment_name="testaksassessment", + cluster_name="testaksassessment-cluster", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AksClusterOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_cluster_operations_list_by_aks_assessment_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_cluster_operations_list_by_aks_assessment_maximum_set_gen.py new file mode 100644 index 000000000000..844ad2c15c92 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_cluster_operations_list_by_aks_assessment_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python aks_cluster_operations_list_by_aks_assessment_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="D6F60DF4-CE70-4E39-8217-B8FBE7CA85AA", + ) + + response = client.aks_cluster_operations.list_by_aks_assessment( + resource_group_name="rgaksswagger", + project_name="testproject", + assessment_name="testaksassessment", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AksClusterOperations_ListByAksAssessment_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_cost_detail_operations_list_by_aks_assessment_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_cost_detail_operations_list_by_aks_assessment_maximum_set_gen.py new file mode 100644 index 000000000000..13308ada67a7 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_cost_detail_operations_list_by_aks_assessment_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python aks_cost_detail_operations_list_by_aks_assessment_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="D6F60DF4-CE70-4E39-8217-B8FBE7CA85AA", + ) + + response = client.aks_cost_detail_operations.list_by_aks_assessment( + resource_group_name="rgaksswagger", + project_name="testproject", + assessment_name="testaksassessment", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AksCostDetailOperations_ListByAksAssessment_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_options_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_options_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..5256764afeb5 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_options_operations_get_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python aks_options_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="D6F60DF4-CE70-4E39-8217-B8FBE7CA85AA", + ) + + response = client.aks_options_operations.get( + resource_group_name="rgaksswagger", + project_name="testproject", + assessment_options_name="default", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AksOptionsOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_options_operations_list_by_assessment_project_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_options_operations_list_by_assessment_project_maximum_set_gen.py new file mode 100644 index 000000000000..dee93a763704 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_options_operations_list_by_assessment_project_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python aks_options_operations_list_by_assessment_project_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="D6F60DF4-CE70-4E39-8217-B8FBE7CA85AA", + ) + + response = client.aks_options_operations.list_by_assessment_project( + resource_group_name="rgaksswagger", + project_name="testproject", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AksOptionsOperations_ListByAssessmentProject_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_summary_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_summary_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..6ce2ec3575c5 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_summary_operations_get_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python aks_summary_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="D6F60DF4-CE70-4E39-8217-B8FBE7CA85AA", + ) + + response = client.aks_summary_operations.get( + resource_group_name="rgaksswagger", + project_name="testproject", + assessment_name="testaksassessment", + summary_name="AKS", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AksSummaryOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_summary_operations_list_by_aks_assessment_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_summary_operations_list_by_aks_assessment_maximum_set_gen.py new file mode 100644 index 000000000000..701bc2fcc054 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/aks_summary_operations_list_by_aks_assessment_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python aks_summary_operations_list_by_aks_assessment_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="D6F60DF4-CE70-4E39-8217-B8FBE7CA85AA", + ) + + response = client.aks_summary_operations.list_by_aks_assessment( + resource_group_name="rgaksswagger", + project_name="testproject", + assessment_name="testaksassessment", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AksSummaryOperations_ListByAksAssessment_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_machines_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_machines_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..c3eeb4b51354 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_machines_operations_get_maximum_set_gen.py @@ -0,0 +1,45 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessed_machines_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="D8E1C413-E65F-40C0-8A7E-743D6B7A6AE9", + ) + + response = client.assessed_machines_operations.get( + resource_group_name="rgopenapi", + project_name="pavqtntysjn", + group_name="smawqdmhfngray", + assessment_name="qjlumxyqsitd", + assessed_machine_name="oqxjeheiipjmuo", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessedMachinesOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_machines_operations_list_by_assessment_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_machines_operations_list_by_assessment_maximum_set_gen.py new file mode 100644 index 000000000000..3ecc331e388c --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_machines_operations_list_by_assessment_maximum_set_gen.py @@ -0,0 +1,45 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessed_machines_operations_list_by_assessment_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="D8E1C413-E65F-40C0-8A7E-743D6B7A6AE9", + ) + + response = client.assessed_machines_operations.list_by_assessment( + resource_group_name="rgopenapi", + project_name="sloqixzfjk", + group_name="kjuepxerwseq", + assessment_name="rhzcmubwrrkhtocsibu", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessedMachinesOperations_ListByAssessment_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_database_v2_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_database_v2_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..87f5560f55d9 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_database_v2_operations_get_maximum_set_gen.py @@ -0,0 +1,45 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessed_sql_database_v2_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.assessed_sql_database_v2_operations.get( + resource_group_name="rgmigrate", + project_name="fci-test6904project", + group_name="test_fci_hadr", + assessment_name="test_swagger_1", + assessed_sql_database_name="858eb860-9e07-417c-91b6-bca1bffb3bf5", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessedSqlDatabaseV2Operations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_database_v2_operations_list_by_sql_assessment_v2_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_database_v2_operations_list_by_sql_assessment_v2_maximum_set_gen.py new file mode 100644 index 000000000000..5678bf4ac627 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_database_v2_operations_list_by_sql_assessment_v2_maximum_set_gen.py @@ -0,0 +1,45 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessed_sql_database_v2_operations_list_by_sql_assessment_v2_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.assessed_sql_database_v2_operations.list_by_sql_assessment_v2( + resource_group_name="rgmigrate", + project_name="fci-test6904project", + group_name="test_fci_hadr", + assessment_name="test_swagger_1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessedSqlDatabaseV2Operations_ListBySqlAssessmentV2_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_instance_v2_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_instance_v2_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..492b05188577 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_instance_v2_operations_get_maximum_set_gen.py @@ -0,0 +1,45 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessed_sql_instance_v2_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.assessed_sql_instance_v2_operations.get( + resource_group_name="rgmigrate", + project_name="fci-test6904project", + group_name="test_fci_hadr", + assessment_name="test_swagger_1", + assessed_sql_instance_name="3c6574cf-b4e1-4fdc-93db-6bbcc570dda2", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessedSqlInstanceV2Operations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_instance_v2_operations_list_by_sql_assessment_v2_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_instance_v2_operations_list_by_sql_assessment_v2_maximum_set_gen.py new file mode 100644 index 000000000000..23a3480bb7e7 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_instance_v2_operations_list_by_sql_assessment_v2_maximum_set_gen.py @@ -0,0 +1,45 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessed_sql_instance_v2_operations_list_by_sql_assessment_v2_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.assessed_sql_instance_v2_operations.list_by_sql_assessment_v2( + resource_group_name="rgmigrate", + project_name="fci-test6904project", + group_name="test_fci_hadr", + assessment_name="test_swagger_1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessedSqlInstanceV2Operations_ListBySqlAssessmentV2_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_machines_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_machines_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..332ae68e0e69 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_machines_operations_get_maximum_set_gen.py @@ -0,0 +1,45 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessed_sql_machines_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.assessed_sql_machines_operations.get( + resource_group_name="rgmigrate", + project_name="fci-test6904project", + group_name="test_fci_hadr", + assessment_name="test_swagger_1", + assessed_sql_machine_name="cc64c9dc-b38e-435d-85ad-d509df5d92c6", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessedSqlMachinesOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_machines_operations_list_by_sql_assessment_v2_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_machines_operations_list_by_sql_assessment_v2_maximum_set_gen.py new file mode 100644 index 000000000000..407c670c3970 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_machines_operations_list_by_sql_assessment_v2_maximum_set_gen.py @@ -0,0 +1,45 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessed_sql_machines_operations_list_by_sql_assessment_v2_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.assessed_sql_machines_operations.list_by_sql_assessment_v2( + resource_group_name="rgmigrate", + project_name="fci-test6904project", + group_name="test_fci_hadr", + assessment_name="test_swagger_1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessedSqlMachinesOperations_ListBySqlAssessmentV2_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_recommended_entity_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_recommended_entity_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..d3fd366803e7 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_recommended_entity_operations_get_maximum_set_gen.py @@ -0,0 +1,45 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessed_sql_recommended_entity_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.assessed_sql_recommended_entity_operations.get( + resource_group_name="rgmigrate", + project_name="fci-test6904project", + group_name="test_fci_hadr", + assessment_name="test_swagger_1", + recommended_assessed_entity_name="cc64c9dc-b38e-435d-85ad-d509df5d92c6", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessedSqlRecommendedEntityOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_recommended_entity_operations_list_by_sql_assessment_v2_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_recommended_entity_operations_list_by_sql_assessment_v2_maximum_set_gen.py new file mode 100644 index 000000000000..522150243d77 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_sql_recommended_entity_operations_list_by_sql_assessment_v2_maximum_set_gen.py @@ -0,0 +1,45 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessed_sql_recommended_entity_operations_list_by_sql_assessment_v2_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.assessed_sql_recommended_entity_operations.list_by_sql_assessment_v2( + resource_group_name="rgmigrate", + project_name="fci-test6904project", + group_name="test_fci_hadr", + assessment_name="test_swagger_1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessedSqlRecommendedEntityOperations_ListBySqlAssessmentV2_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_web_app_v2_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_web_app_v2_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..94c6ce4b5c8b --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_web_app_v2_operations_get_maximum_set_gen.py @@ -0,0 +1,45 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessed_web_app_v2_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="6D59B561-47B6-4AB8-84B5-39CF2B808C26", + ) + + response = client.assessed_web_app_v2_operations.get( + resource_group_name="rgopenapi", + project_name="sumukk-ccy-bcs4557project", + group_name="anraghun-selfhost-v2", + assessment_name="anraghun-selfhost-v2", + assessed_web_app_name="webapp1", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessedWebAppV2Operations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_web_app_v2_operations_list_by_web_app_assessment_v2_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_web_app_v2_operations_list_by_web_app_assessment_v2_maximum_set_gen.py new file mode 100644 index 000000000000..2bb0aa7e49a2 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_web_app_v2_operations_list_by_web_app_assessment_v2_maximum_set_gen.py @@ -0,0 +1,45 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessed_web_app_v2_operations_list_by_web_app_assessment_v2_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="6D59B561-47B6-4AB8-84B5-39CF2B808C26", + ) + + response = client.assessed_web_app_v2_operations.list_by_web_app_assessment_v2( + resource_group_name="rgopenapi", + project_name="sumukk-ccy-bcs4557project", + group_name="akgugrp2", + assessment_name="assess1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessedWebAppV2Operations_ListByWebAppAssessmentV2_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_web_application_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_web_application_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..281579d2f971 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_web_application_operations_get_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessed_web_application_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="D6F60DF4-CE70-4E39-8217-B8FBE7CA85AA", + ) + + response = client.assessed_web_application_operations.get( + resource_group_name="rgaksswagger", + project_name="testproject", + assessment_name="testaksassessment", + assessed_workload="testaksassessmentapp", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessedWebApplicationOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_web_application_operations_list_by_aks_assessment_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_web_application_operations_list_by_aks_assessment_maximum_set_gen.py new file mode 100644 index 000000000000..3d7bfd55a17d --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessed_web_application_operations_list_by_aks_assessment_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessed_web_application_operations_list_by_aks_assessment_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="D6F60DF4-CE70-4E39-8217-B8FBE7CA85AA", + ) + + response = client.assessed_web_application_operations.list_by_aks_assessment( + resource_group_name="rgaksswagger", + project_name="testproject", + assessment_name="testaksassessment", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessedWebApplicationOperations_ListByAksAssessment_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_options_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_options_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..91643566341d --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_options_operations_get_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessment_options_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.assessment_options_operations.get( + resource_group_name="ayagrawrg", + project_name="app18700project", + assessment_options_name="default", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessmentOptionsOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_options_operations_list_by_assessment_project_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_options_operations_list_by_assessment_project_maximum_set_gen.py new file mode 100644 index 000000000000..b50b6a2fd186 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_options_operations_list_by_assessment_project_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessment_options_operations_list_by_assessment_project_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="A926B99C-7F4C-4556-871E-20CB8C6ADB56", + ) + + response = client.assessment_options_operations.list_by_assessment_project( + resource_group_name="rgmigrate", + project_name="fhodvffhuoqwbysrrqbizete", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessmentOptionsOperations_ListByAssessmentProject_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_project_summary_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_project_summary_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..89a95851058d --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_project_summary_operations_get_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessment_project_summary_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.assessment_project_summary_operations.get( + resource_group_name="piyushapp1", + project_name="PiyushApp15328project", + project_summary_name="default", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessmentProjectSummaryOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_project_summary_operations_list_by_assessment_project_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_project_summary_operations_list_by_assessment_project_maximum_set_gen.py new file mode 100644 index 000000000000..a804218e0208 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_project_summary_operations_list_by_assessment_project_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessment_project_summary_operations_list_by_assessment_project_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.assessment_project_summary_operations.list_by_assessment_project( + resource_group_name="piyushapp1", + project_name="PiyushApp15328project", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessmentProjectSummaryOperations_ListByAssessmentProject_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_projects_operations_create_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_projects_operations_create_maximum_set_gen.py new file mode 100644 index 000000000000..8e7e4f78db11 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_projects_operations_create_maximum_set_gen.py @@ -0,0 +1,55 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessment_projects_operations_create_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.assessment_projects_operations.begin_create( + resource_group_name="sakanwar", + project_name="sakanwar1204project", + resource={ + "location": "southeastasia", + "properties": { + "assessmentSolutionId": "/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/sakanwar/providers/Microsoft.Storage/storageAccounts/sakanwar1204usa", + "customerStorageAccountArmId": "/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/sakanwar/providers/Microsoft.Storage/storageAccounts/sakanwar1204usa", + "customerWorkspaceId": None, + "customerWorkspaceLocation": None, + "projectStatus": "Active", + "provisioningState": "Succeeded", + "publicNetworkAccess": "Disabled", + }, + "tags": {"Migrate Project": "sakanwar-PE-SEA"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessmentProjectsOperations_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_projects_operations_delete_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_projects_operations_delete_maximum_set_gen.py new file mode 100644 index 000000000000..917c7e4708b8 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_projects_operations_delete_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessment_projects_operations_delete_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="A926B99C-7F4C-4556-871E-20CB8C6ADB56", + ) + + client.assessment_projects_operations.delete( + resource_group_name="rgmigrate", + project_name="zqrsyncwahgydqvwuchkfd", + ) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessmentProjectsOperations_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_projects_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_projects_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..92f2c8d4db02 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_projects_operations_get_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessment_projects_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.assessment_projects_operations.get( + resource_group_name="sakanwar", + project_name="sakanwar1204project", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessmentProjectsOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_projects_operations_list_by_resource_group_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_projects_operations_list_by_resource_group_maximum_set_gen.py new file mode 100644 index 000000000000..1fe448c2dddb --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_projects_operations_list_by_resource_group_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessment_projects_operations_list_by_resource_group_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.assessment_projects_operations.list_by_resource_group( + resource_group_name="sakanwar", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessmentProjectsOperations_ListByResourceGroup_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_projects_operations_list_by_subscription_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_projects_operations_list_by_subscription_maximum_set_gen.py new file mode 100644 index 000000000000..7d1421e7d88d --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_projects_operations_list_by_subscription_maximum_set_gen.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessment_projects_operations_list_by_subscription_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.assessment_projects_operations.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessmentProjectsOperations_ListBySubscription_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_projects_operations_update_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_projects_operations_update_maximum_set_gen.py new file mode 100644 index 000000000000..b8814fb8770b --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessment_projects_operations_update_maximum_set_gen.py @@ -0,0 +1,54 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessment_projects_operations_update_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.assessment_projects_operations.begin_update( + resource_group_name="sakanwar", + project_name="sakanwar1204project", + properties={ + "properties": { + "assessmentSolutionId": "/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/sakanwar/providers/Microsoft.Storage/storageAccounts/sakanwar1204usa", + "customerStorageAccountArmId": "/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/sakanwar/providers/Microsoft.Storage/storageAccounts/sakanwar1204usa", + "customerWorkspaceId": None, + "customerWorkspaceLocation": None, + "projectStatus": "Active", + "provisioningState": "Succeeded", + "publicNetworkAccess": "Disabled", + }, + "tags": {"Migrate Project": "sakanwar-PE-SEA"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessmentProjectsOperations_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessments_operations_create_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessments_operations_create_maximum_set_gen.py new file mode 100644 index 000000000000..6c254141d53d --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessments_operations_create_maximum_set_gen.py @@ -0,0 +1,72 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessments_operations_create_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.assessments_operations.begin_create( + resource_group_name="ayagrawrg", + project_name="app18700project", + group_name="kuchatur-test", + assessment_name="asm1", + resource={ + "properties": { + "assessmentType": "Unknown", + "azureDiskTypes": ["Premium", "PremiumV2", "StandardSSD"], + "azureHybridUseBenefit": "Unknown", + "azureLocation": "njxbwdtsxzhichsnk", + "azureOfferCode": "Unknown", + "azurePricingTier": "Standard", + "azureStorageRedundancy": "Unknown", + "azureVmFamilies": ["D_series", "Lsv2_series", "M_series", "Mdsv2_series", "Msv2_series", "Mv2_series"], + "currency": "Unknown", + "discountPercentage": 6, + "eaSubscriptionId": "kwsu", + "groupType": "Default", + "linuxAzureHybridUseBenefit": "Unknown", + "percentile": "Percentile50", + "perfDataEndTime": "2023-09-26T09:36:48.491Z", + "perfDataStartTime": "2023-09-26T09:36:48.491Z", + "provisioningState": "Succeeded", + "reservedInstance": "None", + "scalingFactor": 24, + "sizingCriterion": "PerformanceBased", + "stage": "InProgress", + "status": "Created", + "timeRange": "Day", + "vmUptime": {"daysPerMonth": 13, "hoursPerDay": 26}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessmentsOperations_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessments_operations_delete_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessments_operations_delete_maximum_set_gen.py new file mode 100644 index 000000000000..fa797bc62aaa --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessments_operations_delete_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessments_operations_delete_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + client.assessments_operations.delete( + resource_group_name="ayagrawrg", + project_name="app18700project", + group_name="kuchatur-test", + assessment_name="asm1", + ) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessmentsOperations_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessments_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessments_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..fa74f2ec6d18 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessments_operations_get_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessments_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.assessments_operations.get( + resource_group_name="ayagrawrg", + project_name="app18700project", + group_name="kuchatur-test", + assessment_name="asm1", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessmentsOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessments_operations_list_by_group_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessments_operations_list_by_group_maximum_set_gen.py new file mode 100644 index 000000000000..177a4193c016 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/assessments_operations_list_by_group_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python assessments_operations_list_by_group_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.assessments_operations.list_by_group( + resource_group_name="ayagrawrg", + project_name="app18700project", + group_name="kuchatur-test", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AssessmentsOperations_ListByGroup_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessed_machines_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessed_machines_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..a3ad98c22434 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessed_machines_operations_get_maximum_set_gen.py @@ -0,0 +1,45 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python avs_assessed_machines_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.avs_assessed_machines_operations.get( + resource_group_name="ayagrawrg", + project_name="app18700project", + group_name="kuchatur-test", + assessment_name="asm2", + avs_assessed_machine_name="b6d6fc6f-796f-4c16-96af-a6d22e0f12f7", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AvsAssessedMachinesOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessed_machines_operations_list_by_avs_assessment_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessed_machines_operations_list_by_avs_assessment_maximum_set_gen.py new file mode 100644 index 000000000000..6186b83b6691 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessed_machines_operations_list_by_avs_assessment_maximum_set_gen.py @@ -0,0 +1,45 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python avs_assessed_machines_operations_list_by_avs_assessment_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.avs_assessed_machines_operations.list_by_avs_assessment( + resource_group_name="ayagrawrg", + project_name="app18700project", + group_name="kuchatur-test", + assessment_name="asm2", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AvsAssessedMachinesOperations_ListByAvsAssessment_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessment_options_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessment_options_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..8dd723aa310d --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessment_options_operations_get_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python avs_assessment_options_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.avs_assessment_options_operations.get( + resource_group_name="ayagrawrg", + project_name="app18700project", + avs_assessment_options_name="default", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AvsAssessmentOptionsOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessment_options_operations_list_by_assessment_project_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessment_options_operations_list_by_assessment_project_maximum_set_gen.py new file mode 100644 index 000000000000..4e5548c03a23 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessment_options_operations_list_by_assessment_project_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python avs_assessment_options_operations_list_by_assessment_project_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.avs_assessment_options_operations.list_by_assessment_project( + resource_group_name="ayagrawrg", + project_name="app18700project", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AvsAssessmentOptionsOperations_ListByAssessmentProject_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessments_operations_create_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessments_operations_create_maximum_set_gen.py new file mode 100644 index 000000000000..2efe874e9539 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessments_operations_create_maximum_set_gen.py @@ -0,0 +1,78 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python avs_assessments_operations_create_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.avs_assessments_operations.begin_create( + resource_group_name="ayagrawrg", + project_name="app18700project", + group_name="kuchatur-test", + assessment_name="asm2", + resource={ + "properties": { + "assessmentType": "AvsAssessment", + "avsAssessmentScenario": "NewAvsSddc", + "azureLocation": "EastUs", + "azureOfferCode": "MSAZR0003P", + "cpuHeadroom": 12, + "currency": "USD", + "dedupeCompression": 1.5, + "discountPercentage": 0, + "externalStorageTypes": ["AnfStandard", "AnfPremium", "AnfUltra"], + "failuresToTolerateAndRaidLevel": "Unknown", + "failuresToTolerateAndRaidLevelList": ["Ftt1Raid1", "Ftt1Raid5", "Ftt3Raid1"], + "groupType": "Default", + "isStretchClusterEnabled": True, + "isVcfByolEnabled": True, + "memOvercommit": 1, + "nodeType": "Unknown", + "nodeTypes": ["AV36", "AV52", "AV36P", "AV64"], + "percentile": "Percentile95", + "perfDataEndTime": "2023-09-26T13:35:56.5671462Z", + "perfDataStartTime": "2023-09-25T13:35:56.5671462Z", + "provisioningState": "Succeeded", + "reservedInstance": "RI3Year", + "scalingFactor": 1, + "sizingCriterion": "AsOnPremises", + "stage": "InProgress", + "status": "Created", + "suitability": "Unknown", + "suitabilityExplanation": "Unknown", + "timeRange": "Day", + "vcpuOversubscription": 4, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AvsAssessmentsOperations_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessments_operations_delete_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessments_operations_delete_maximum_set_gen.py new file mode 100644 index 000000000000..26751a4d1278 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessments_operations_delete_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python avs_assessments_operations_delete_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + client.avs_assessments_operations.delete( + resource_group_name="ayagrawrg", + project_name="app18700project", + group_name="kuchatur-test", + assessment_name="asm2", + ) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AvsAssessmentsOperations_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessments_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessments_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..ee4f02ef1182 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessments_operations_get_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python avs_assessments_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.avs_assessments_operations.get( + resource_group_name="ayagrawrg", + project_name="app18700project", + group_name="kuchatur-test", + assessment_name="asm2", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AvsAssessmentsOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessments_operations_list_by_group_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessments_operations_list_by_group_maximum_set_gen.py new file mode 100644 index 000000000000..70904d9fc699 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/avs_assessments_operations_list_by_group_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python avs_assessments_operations_list_by_group_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.avs_assessments_operations.list_by_group( + resource_group_name="ayagrawrg", + project_name="app18700project", + group_name="kuchatur-test", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/AvsAssessmentsOperations_ListByGroup_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_avs_summary_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_avs_summary_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..f319a7d89ea4 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_avs_summary_operations_get_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python business_case_avs_summary_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="ADC896AD-6A38-454E-9A62-AFC618F5F4BC", + ) + + response = client.business_case_avs_summary_operations.get( + resource_group_name="rgopenapi", + project_name="multipleto8617project", + business_case_name="sample-business-case", + avs_summary_name="default", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/BusinessCaseAvsSummaryOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_avs_summary_operations_list_by_business_case_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_avs_summary_operations_list_by_business_case_maximum_set_gen.py new file mode 100644 index 000000000000..74915965cf2b --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_avs_summary_operations_list_by_business_case_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python business_case_avs_summary_operations_list_by_business_case_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="ADC896AD-6A38-454E-9A62-AFC618F5F4BC", + ) + + response = client.business_case_avs_summary_operations.list_by_business_case( + resource_group_name="rgopenapi", + project_name="multipleto8617project", + business_case_name="sample-business-case", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/BusinessCaseAvsSummaryOperations_ListByBusinessCase_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_iaas_summary_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_iaas_summary_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..0ce09274b9f5 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_iaas_summary_operations_get_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python business_case_iaas_summary_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="ADC896AD-6A38-454E-9A62-AFC618F5F4BC", + ) + + response = client.business_case_iaas_summary_operations.get( + resource_group_name="rgopenapi", + project_name="multipleto8617project", + business_case_name="sample-business-case", + iaas_summary_name="default", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/BusinessCaseIaasSummaryOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_iaas_summary_operations_list_by_business_case_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_iaas_summary_operations_list_by_business_case_maximum_set_gen.py new file mode 100644 index 000000000000..2cf64b0124a0 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_iaas_summary_operations_list_by_business_case_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python business_case_iaas_summary_operations_list_by_business_case_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="ADC896AD-6A38-454E-9A62-AFC618F5F4BC", + ) + + response = client.business_case_iaas_summary_operations.list_by_business_case( + resource_group_name="rgopenapi", + project_name="multipleto8617project", + business_case_name="sample-business-case", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/BusinessCaseIaasSummaryOperations_ListByBusinessCase_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_operations_create_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_operations_create_maximum_set_gen.py new file mode 100644 index 000000000000..73b353b71675 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_operations_create_maximum_set_gen.py @@ -0,0 +1,116 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python business_case_operations_create_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="ADC896AD-6A38-454E-9A62-AFC618F5F4BC", + ) + + response = client.business_case_operations.begin_create( + resource_group_name="rgopenapi", + project_name="multipleto8617project", + business_case_name="sample-business-case", + resource={ + "properties": { + "settings": { + "azureArcSettings": { + "azureArcState": "Enabled", + "laborCostPercentage": 70, + "managementSettings": {"monitoringSettings": {"alertRulesCount": 10, "logsVolumeInGB": 0.5}}, + }, + "azureSettings": { + "avsLaborCostPercentage": 0, + "businessCaseType": "OptimizeForCost", + "comfortFactor": 29, + "currency": "USD", + "discountPercentage": 83, + "iaasLaborCostPercentage": 94, + "infrastructureGrowthRate": 83, + "networkCostPercentage": 40, + "paasLaborCostPercentage": 47, + "perYearMigrationCompletionPercentage": {"Year0": 20, "Year1": 30, "Year2": 60, "Year3": 90}, + "performanceDataEndTime": "2023-11-08T07:10:07.764Z", + "performanceDataStartTime": "2023-11-08T07:10:07.764Z", + "performanceUtilizationPercentile": 4, + "savingsOption": "RI3Year", + "targetLocation": "WestUs2", + "wacc": 79, + "workloadDiscoverySource": "Appliance", + }, + "onPremiseSettings": { + "computeSettings": { + "hyperthreadCoreToMemoryRatio": 12, + "price": 16, + "rhelLinuxServerLicensing": {"licenseCost": 9}, + "sqlServerLicensing": [ + {"licenseCost": 27, "softwareAssuranceCost": 16, "version": "Enterprise"} + ], + "suseLinuxServerLicensing": {"licenseCost": 9}, + "virtualizationSoftwareSettings": {"vMwareCloudFoundationLicenseCost": 7}, + "windowsServerLicensing": { + "licenseCost": 9, + "licensesPerCore": 11, + "softwareAssuranceCost": 1, + }, + }, + "facilitySettings": {"facilitiesCostPerKwh": 28}, + "laborSettings": { + "hourlyAdminCost": 25, + "physicalServersPerAdmin": 6, + "virtualMachinesPerAdmin": 24, + }, + "managementSettings": { + "hypervVirtualizationManagementSettings": { + "licenseAndSupportList": [{"licenseCost": 4, "licenseType": "Standard"}], + "numberOfPhysicalCoresPerLicense": 2, + "softwareAssuranceCost": 11, + }, + "otherManagementCostsSettings": { + "dataProtectionCostPerServerPerYear": 18, + "monitoringCostPerServerPerYear": 10, + "patchingCostPerServerPerYear": 18, + }, + "thirdPartyManagementSettings": {"licenseCost": 23, "supportCost": 9}, + }, + "networkSettings": {"hardwareSoftwareCostPercentage": 50, "maintenanceCostPercentage": 48}, + "securitySettings": { + "serverSecurityCostPerServerPerYear": 14, + "sqlServerSecurityCostPerServerPerYear": 7, + }, + "storageSettings": {"costPerGbPerMonth": 22, "maintainanceCostPercentageToAcquisitionCost": 1}, + }, + }, + "state": "InProgress", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/BusinessCaseOperations_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_operations_delete_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_operations_delete_maximum_set_gen.py new file mode 100644 index 000000000000..2ca28d36305c --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_operations_delete_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python business_case_operations_delete_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="ADC896AD-6A38-454E-9A62-AFC618F5F4BC", + ) + + client.business_case_operations.delete( + resource_group_name="rgopenapi", + project_name="multipleto8617project", + business_case_name="sample-business-case", + ) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/BusinessCaseOperations_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..2261ce5d5c47 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_operations_get_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python business_case_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="ADC896AD-6A38-454E-9A62-AFC618F5F4BC", + ) + + response = client.business_case_operations.get( + resource_group_name="rgopenapi", + project_name="multipleto8617project", + business_case_name="sample-business-case", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/BusinessCaseOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_operations_list_by_assessment_project_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_operations_list_by_assessment_project_maximum_set_gen.py new file mode 100644 index 000000000000..bed4390bf76b --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_operations_list_by_assessment_project_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python business_case_operations_list_by_assessment_project_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="ADC896AD-6A38-454E-9A62-AFC618F5F4BC", + ) + + response = client.business_case_operations.list_by_assessment_project( + resource_group_name="rgopenapi", + project_name="multipleto8617project", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/BusinessCaseOperations_ListByAssessmentProject_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_overview_summary_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_overview_summary_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..f323c56d0f70 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_overview_summary_operations_get_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python business_case_overview_summary_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="ADC896AD-6A38-454E-9A62-AFC618F5F4BC", + ) + + response = client.business_case_overview_summary_operations.get( + resource_group_name="rgopenapi", + project_name="multipleto8617project", + business_case_name="sample-business-case", + overview_summary_name="default", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/BusinessCaseOverviewSummaryOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_overview_summary_operations_list_by_business_case_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_overview_summary_operations_list_by_business_case_maximum_set_gen.py new file mode 100644 index 000000000000..4285cdbe2f39 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_overview_summary_operations_list_by_business_case_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python business_case_overview_summary_operations_list_by_business_case_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="ADC896AD-6A38-454E-9A62-AFC618F5F4BC", + ) + + response = client.business_case_overview_summary_operations.list_by_business_case( + resource_group_name="rgopenapi", + project_name="multipleto8617project", + business_case_name="sample-business-case", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/BusinessCaseOverviewSummaryOperations_ListByBusinessCase_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_paas_summary_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_paas_summary_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..e8cd61d3ca3e --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_paas_summary_operations_get_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python business_case_paas_summary_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="ADC896AD-6A38-454E-9A62-AFC618F5F4BC", + ) + + response = client.business_case_paas_summary_operations.get( + resource_group_name="rgopenapi", + project_name="multipleto8617project", + business_case_name="sample-business-case", + paas_summary_name="default", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/BusinessCasePaasSummaryOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_paas_summary_operations_list_by_business_case_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_paas_summary_operations_list_by_business_case_maximum_set_gen.py new file mode 100644 index 000000000000..e617c3f51c64 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/business_case_paas_summary_operations_list_by_business_case_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python business_case_paas_summary_operations_list_by_business_case_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="ADC896AD-6A38-454E-9A62-AFC618F5F4BC", + ) + + response = client.business_case_paas_summary_operations.list_by_business_case( + resource_group_name="rgopenapi", + project_name="multipleto8617project", + business_case_name="sample-business-case", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/BusinessCasePaasSummaryOperations_ListByBusinessCase_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_avs_machines_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_avs_machines_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..4b4fc94d4b73 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_avs_machines_operations_get_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python evaluated_avs_machines_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="ADC896AD-6A38-454E-9A62-AFC618F5F4BC", + ) + + response = client.evaluated_avs_machines_operations.get( + resource_group_name="rgopenapi", + project_name="multipleto8617project", + business_case_name="sample-business-case", + evaluated_avs_machine_name="a404-r1w16-1.FPL.COM", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/EvaluatedAvsMachinesOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_avs_machines_operations_list_by_business_case_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_avs_machines_operations_list_by_business_case_maximum_set_gen.py new file mode 100644 index 000000000000..4b7e8879a177 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_avs_machines_operations_list_by_business_case_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python evaluated_avs_machines_operations_list_by_business_case_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="ADC896AD-6A38-454E-9A62-AFC618F5F4BC", + ) + + response = client.evaluated_avs_machines_operations.list_by_business_case( + resource_group_name="rgopenapi", + project_name="multipleto8617project", + business_case_name="sample-business-case", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/EvaluatedAvsMachinesOperations_ListByBusinessCase_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_machines_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_machines_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..cf15c3a631c4 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_machines_operations_get_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python evaluated_machines_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="ADC896AD-6A38-454E-9A62-AFC618F5F4BC", + ) + + response = client.evaluated_machines_operations.get( + resource_group_name="rgopenapi", + project_name="multipleto8617project", + business_case_name="sample-business-case", + evaluated_machine_name="a404-r1w16-1.FPL.COM", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/EvaluatedMachinesOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_machines_operations_list_by_business_case_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_machines_operations_list_by_business_case_maximum_set_gen.py new file mode 100644 index 000000000000..47a7f041ff7b --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_machines_operations_list_by_business_case_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python evaluated_machines_operations_list_by_business_case_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="ADC896AD-6A38-454E-9A62-AFC618F5F4BC", + ) + + response = client.evaluated_machines_operations.list_by_business_case( + resource_group_name="rgopenapi", + project_name="multipleto8617project", + business_case_name="sample-business-case", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/EvaluatedMachinesOperations_ListByBusinessCase_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_sql_entities_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_sql_entities_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..70b6ef6ba9c8 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_sql_entities_operations_get_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python evaluated_sql_entities_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="ADC896AD-6A38-454E-9A62-AFC618F5F4BC", + ) + + response = client.evaluated_sql_entities_operations.get( + resource_group_name="rgopenapi", + project_name="multipleto8617project", + business_case_name="sample-business-case", + evaluated_sql_entity_name="a404-r1w16-1.FPL.COM", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/EvaluatedSqlEntitiesOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_sql_entities_operations_list_by_business_case_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_sql_entities_operations_list_by_business_case_maximum_set_gen.py new file mode 100644 index 000000000000..487c246880a7 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_sql_entities_operations_list_by_business_case_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python evaluated_sql_entities_operations_list_by_business_case_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="ADC896AD-6A38-454E-9A62-AFC618F5F4BC", + ) + + response = client.evaluated_sql_entities_operations.list_by_business_case( + resource_group_name="rgopenapi", + project_name="multipleto8617project", + business_case_name="sample-business-case", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/EvaluatedSqlEntitiesOperations_ListByBusinessCase_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_web_apps_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_web_apps_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..4d0092e6c8f2 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_web_apps_operations_get_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python evaluated_web_apps_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="ADC896AD-6A38-454E-9A62-AFC618F5F4BC", + ) + + response = client.evaluated_web_apps_operations.get( + resource_group_name="rgopenapi", + project_name="multipleto8617project", + business_case_name="sample-business-case", + evaluated_web_app_name="a404-r1w16-1.FPL.COM", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/EvaluatedWebAppsOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_web_apps_operations_list_by_business_case_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_web_apps_operations_list_by_business_case_maximum_set_gen.py new file mode 100644 index 000000000000..2269ef71fd43 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/evaluated_web_apps_operations_list_by_business_case_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python evaluated_web_apps_operations_list_by_business_case_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="ADC896AD-6A38-454E-9A62-AFC618F5F4BC", + ) + + response = client.evaluated_web_apps_operations.list_by_business_case( + resource_group_name="rgopenapi", + project_name="multipleto8617project", + business_case_name="sample-business-case", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/EvaluatedWebAppsOperations_ListByBusinessCase_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/groups_operations_create_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/groups_operations_create_maximum_set_gen.py new file mode 100644 index 000000000000..e30d951c3814 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/groups_operations_create_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python groups_operations_create_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.groups_operations.begin_create( + resource_group_name="ayagrawrg", + project_name="app18700project", + group_name="kuchatur-test", + resource={"properties": {"groupStatus": "Completed", "groupType": "Default", "provisioningState": "Succeeded"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/GroupsOperations_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/groups_operations_delete_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/groups_operations_delete_maximum_set_gen.py new file mode 100644 index 000000000000..5fdcd63744e5 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/groups_operations_delete_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python groups_operations_delete_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + client.groups_operations.delete( + resource_group_name="ayagrawrg", + project_name="app18700project", + group_name="kuchatur-test", + ) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/GroupsOperations_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/groups_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/groups_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..c5b0f051ffb5 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/groups_operations_get_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python groups_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.groups_operations.get( + resource_group_name="ayagrawrg", + project_name="app18700project", + group_name="kuchatur-test", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/GroupsOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/groups_operations_list_by_assessment_project_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/groups_operations_list_by_assessment_project_maximum_set_gen.py new file mode 100644 index 000000000000..fd435c509af4 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/groups_operations_list_by_assessment_project_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python groups_operations_list_by_assessment_project_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.groups_operations.list_by_assessment_project( + resource_group_name="ayagrawrg", + project_name="app18700project", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/GroupsOperations_ListByAssessmentProject_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/groups_operations_update_machines_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/groups_operations_update_machines_maximum_set_gen.py new file mode 100644 index 000000000000..11a83662d4bc --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/groups_operations_update_machines_maximum_set_gen.py @@ -0,0 +1,52 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python groups_operations_update_machines_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.groups_operations.begin_update_machines( + resource_group_name="ayagrawrg", + project_name="app18700project", + group_name="kuchatur-test", + body={ + "eTag": "*", + "properties": { + "machines": [ + "/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/ayagrawrg/providers/Microsoft.Migrate/assessmentprojects/app18700project/machines/18895660-c5e5-4247-8cfc-cd24e1fe57f3" + ], + "operationType": "Add", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/GroupsOperations_UpdateMachines_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/hyperv_collectors_operations_create_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/hyperv_collectors_operations_create_maximum_set_gen.py new file mode 100644 index 000000000000..007f02498913 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/hyperv_collectors_operations_create_maximum_set_gen.py @@ -0,0 +1,61 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python hyperv_collectors_operations_create_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.hyperv_collectors_operations.begin_create( + resource_group_name="ayagrawRG", + project_name="app18700project", + hyperv_collector_name="test-697cecollector", + resource={ + "properties": { + "agentProperties": { + "id": "12f1d90f-b3fa-4926-8893-e56803a09af0", + "lastHeartbeatUtc": "2022-07-07T14:25:35.708325Z", + "spnDetails": { + "applicationId": "e3bd6eaa-980b-40ae-a30e-2a5069ba097c", + "audience": "e3bd6eaa-980b-40ae-a30e-2a5069ba097c", + "authority": "https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47", + "objectId": "01b9f9e2-2d82-414c-adaa-09ce259b6b44", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + }, + "version": "2.0.1993.19", + }, + "discoverySiteId": "/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/ayagrawRG/providers/Microsoft.OffAzure/HyperVSites/test-60527site", + "provisioningState": "Succeeded", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/HypervCollectorsOperations_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/hyperv_collectors_operations_delete_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/hyperv_collectors_operations_delete_maximum_set_gen.py new file mode 100644 index 000000000000..058b5202a05c --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/hyperv_collectors_operations_delete_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python hyperv_collectors_operations_delete_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + client.hyperv_collectors_operations.delete( + resource_group_name="ayagrawRG", + project_name="app18700project", + hyperv_collector_name="test-697cecollector", + ) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/HypervCollectorsOperations_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/hyperv_collectors_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/hyperv_collectors_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..0515d65c38ee --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/hyperv_collectors_operations_get_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python hyperv_collectors_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.hyperv_collectors_operations.get( + resource_group_name="ayagrawRG", + project_name="app18700project", + hyperv_collector_name="test-697cecollector", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/HypervCollectorsOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/hyperv_collectors_operations_list_by_assessment_project_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/hyperv_collectors_operations_list_by_assessment_project_maximum_set_gen.py new file mode 100644 index 000000000000..5e4fb3c68a90 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/hyperv_collectors_operations_list_by_assessment_project_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python hyperv_collectors_operations_list_by_assessment_project_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.hyperv_collectors_operations.list_by_assessment_project( + resource_group_name="ayagrawRG", + project_name="app18700project", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/HypervCollectorsOperations_ListByAssessmentProject_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/import_collectors_operations_create_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/import_collectors_operations_create_maximum_set_gen.py new file mode 100644 index 000000000000..c0341d835d79 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/import_collectors_operations_create_maximum_set_gen.py @@ -0,0 +1,49 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python import_collectors_operations_create_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.import_collectors_operations.begin_create( + resource_group_name="ayagrawRG", + project_name="app18700project", + import_collector_name="importCollectore7d5", + resource={ + "properties": { + "discoverySiteId": "/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourcegroups/ayagrawRG/providers/microsoft.offazure/importsites/actualSEA37d4importSite", + "provisioningState": "Succeeded", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/ImportCollectorsOperations_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/import_collectors_operations_delete_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/import_collectors_operations_delete_maximum_set_gen.py new file mode 100644 index 000000000000..2bea2f0ecdd9 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/import_collectors_operations_delete_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python import_collectors_operations_delete_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + client.import_collectors_operations.delete( + resource_group_name="ayagrawRG", + project_name="app18700project", + import_collector_name="importCollectore7d5", + ) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/ImportCollectorsOperations_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/import_collectors_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/import_collectors_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..b4cf7f257b23 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/import_collectors_operations_get_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python import_collectors_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.import_collectors_operations.get( + resource_group_name="ayagrawRG", + project_name="app18700project", + import_collector_name="importCollectore7d5", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/ImportCollectorsOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/import_collectors_operations_list_by_assessment_project_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/import_collectors_operations_list_by_assessment_project_maximum_set_gen.py new file mode 100644 index 000000000000..f850f032434a --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/import_collectors_operations_list_by_assessment_project_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python import_collectors_operations_list_by_assessment_project_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.import_collectors_operations.list_by_assessment_project( + resource_group_name="ayagrawRG", + project_name="app18700project", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/ImportCollectorsOperations_ListByAssessmentProject_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/machines_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/machines_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..e28ef08455aa --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/machines_operations_get_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python machines_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.machines_operations.get( + resource_group_name="ayagrawrg", + project_name="app18700project", + machine_name="55082b89-99e2-4c40-b63f-d4f4d6ba961d", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/MachinesOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/machines_operations_list_by_assessment_project_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/machines_operations_list_by_assessment_project_maximum_set_gen.py new file mode 100644 index 000000000000..6717a4e65793 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/machines_operations_list_by_assessment_project_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python machines_operations_list_by_assessment_project_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.machines_operations.list_by_assessment_project( + resource_group_name="ayagrawrg", + project_name="app18700project", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/MachinesOperations_ListByAssessmentProject_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/operations_list_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/operations_list_maximum_set_gen.py new file mode 100644 index 000000000000..2a10d4f7f56d --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/operations_list_maximum_set_gen.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python operations_list_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/Operations_List_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/private_endpoint_connection_operations_delete_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/private_endpoint_connection_operations_delete_maximum_set_gen.py new file mode 100644 index 000000000000..8749a70b602d --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/private_endpoint_connection_operations_delete_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python private_endpoint_connection_operations_delete_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + client.private_endpoint_connection_operations.delete( + resource_group_name="sakanwar", + project_name="sakanwar1204project", + private_endpoint_connection_name="sakanwar1204project1634pe.bf42f8a1-09f5-4ee4-aea6-a019cc60f9d7", + ) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/PrivateEndpointConnectionOperations_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/private_endpoint_connection_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/private_endpoint_connection_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..2ae1b498ccb8 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/private_endpoint_connection_operations_get_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python private_endpoint_connection_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.private_endpoint_connection_operations.get( + resource_group_name="sakanwar", + project_name="sakanwar1204project", + private_endpoint_connection_name="sakanwar1204project1634pe.bf42f8a1-09f5-4ee4-aea6-a019cc60f9d7", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/PrivateEndpointConnectionOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/private_endpoint_connection_operations_list_by_assessment_project_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/private_endpoint_connection_operations_list_by_assessment_project_maximum_set_gen.py new file mode 100644 index 000000000000..3583c5f0d89d --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/private_endpoint_connection_operations_list_by_assessment_project_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python private_endpoint_connection_operations_list_by_assessment_project_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.private_endpoint_connection_operations.list_by_assessment_project( + resource_group_name="sakanwar", + project_name="sakanwar1204project", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/PrivateEndpointConnectionOperations_ListByAssessmentProject_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/private_endpoint_connection_operations_update_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/private_endpoint_connection_operations_update_maximum_set_gen.py new file mode 100644 index 000000000000..1e7e788da947 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/private_endpoint_connection_operations_update_maximum_set_gen.py @@ -0,0 +1,49 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python private_endpoint_connection_operations_update_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.private_endpoint_connection_operations.begin_update( + resource_group_name="sakanwar", + project_name="sakanwar1204project", + private_endpoint_connection_name="sakanwar1204project1634pe.bf42f8a1-09f5-4ee4-aea6-a019cc60f9d7", + resource={ + "properties": { + "privateEndpoint": {}, + "privateLinkServiceConnectionState": {"actionsRequired": "", "description": None, "status": "Approved"}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/PrivateEndpointConnectionOperations_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/private_link_resource_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/private_link_resource_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..e46a3e626e48 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/private_link_resource_operations_get_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python private_link_resource_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.private_link_resource_operations.get( + resource_group_name="sakanwar", + project_name="sakanwar1204project", + private_link_resource_name="Default", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/PrivateLinkResourceOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/private_link_resource_operations_list_by_assessment_project_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/private_link_resource_operations_list_by_assessment_project_maximum_set_gen.py new file mode 100644 index 000000000000..24c383f7e085 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/private_link_resource_operations_list_by_assessment_project_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python private_link_resource_operations_list_by_assessment_project_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.private_link_resource_operations.list_by_assessment_project( + resource_group_name="sakanwar", + project_name="sakanwar1204project", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/PrivateLinkResourceOperations_ListByAssessmentProject_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/server_collectors_operations_create_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/server_collectors_operations_create_maximum_set_gen.py new file mode 100644 index 000000000000..730de2b7c9f3 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/server_collectors_operations_create_maximum_set_gen.py @@ -0,0 +1,61 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python server_collectors_operations_create_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.server_collectors_operations.begin_create( + resource_group_name="ayagrawRG", + project_name="app18700project", + server_collector_name="walter389fcollector", + resource={ + "properties": { + "agentProperties": { + "id": "498e4965-bbb1-47c2-8613-345baff9c509", + "lastHeartbeatUtc": None, + "spnDetails": { + "applicationId": "65153d2f-9afb-44e8-b3ca-1369150b7354", + "audience": "65153d2f-9afb-44e8-b3ca-1369150b7354", + "authority": "https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47", + "objectId": "ddde6f96-87c8-420b-9d4d-f16a5090519e", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + }, + "version": None, + }, + "discoverySiteId": "/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/ayagrawRG/providers/Microsoft.OffAzure/ServerSites/walter7155site", + "provisioningState": "Succeeded", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/ServerCollectorsOperations_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/server_collectors_operations_delete_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/server_collectors_operations_delete_maximum_set_gen.py new file mode 100644 index 000000000000..d9299f2bcf54 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/server_collectors_operations_delete_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python server_collectors_operations_delete_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + client.server_collectors_operations.delete( + resource_group_name="ayagrawRG", + project_name="app18700project", + server_collector_name="walter389fcollector", + ) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/ServerCollectorsOperations_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/server_collectors_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/server_collectors_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..aba5545003eb --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/server_collectors_operations_get_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python server_collectors_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.server_collectors_operations.get( + resource_group_name="ayagrawRG", + project_name="app18700project", + server_collector_name="walter389fcollector", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/ServerCollectorsOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/server_collectors_operations_list_by_assessment_project_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/server_collectors_operations_list_by_assessment_project_maximum_set_gen.py new file mode 100644 index 000000000000..cab11dda7639 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/server_collectors_operations_list_by_assessment_project_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python server_collectors_operations_list_by_assessment_project_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.server_collectors_operations.list_by_assessment_project( + resource_group_name="ayagrawRG", + project_name="app18700project", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/ServerCollectorsOperations_ListByAssessmentProject_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_options_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_options_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..e3803ea405ce --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_options_operations_get_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python sql_assessment_options_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.sql_assessment_options_operations.get( + resource_group_name="rgmigrate", + project_name="fci-test6904project", + assessment_options_name="default", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/SqlAssessmentOptionsOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_options_operations_list_by_assessment_project_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_options_operations_list_by_assessment_project_maximum_set_gen.py new file mode 100644 index 000000000000..ea6835a7a973 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_options_operations_list_by_assessment_project_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python sql_assessment_options_operations_list_by_assessment_project_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.sql_assessment_options_operations.list_by_assessment_project( + resource_group_name="rgmigrate", + project_name="fci-test6904project", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/SqlAssessmentOptionsOperations_ListByAssessmentProject_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_v2_operations_create_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_v2_operations_create_maximum_set_gen.py new file mode 100644 index 000000000000..1a843314b223 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_v2_operations_create_maximum_set_gen.py @@ -0,0 +1,79 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python sql_assessment_v2_operations_create_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.sql_assessment_v2_operations.begin_create( + resource_group_name="rgmigrate", + project_name="fci-test6904project", + group_name="test_fci_hadr", + assessment_name="test_swagger_1", + resource={ + "properties": { + "asyncCommitModeIntent": "DisasterRecovery", + "azureLocation": "SoutheastAsia", + "azureOfferCode": "MSAZR0003P", + "azureOfferCodeForVm": "MSAZR0003P", + "azureSqlDatabaseSettings": { + "azureSqlComputeTier": "Automatic", + "azureSqlDataBaseType": "SingleDatabase", + "azureSqlPurchaseModel": "VCore", + "azureSqlServiceTier": "Automatic", + }, + "azureSqlManagedInstanceSettings": { + "azureSqlInstanceType": "SingleInstance", + "azureSqlServiceTier": "Automatic", + }, + "azureSqlVmSettings": {"instanceSeries": ["Eadsv5_series"]}, + "currency": "USD", + "disasterRecoveryLocation": "EastAsia", + "discountPercentage": 0, + "enableHadrAssessment": True, + "entityUptime": {"daysPerMonth": 30, "hoursPerDay": 24}, + "environmentType": "Production", + "multiSubnetIntent": "DisasterRecovery", + "optimizationLogic": "MinimizeCost", + "osLicense": "Unknown", + "percentile": "Percentile95", + "reservedInstance": "None", + "reservedInstanceForVm": "None", + "scalingFactor": 1, + "sizingCriterion": "PerformanceBased", + "sqlServerLicense": "Unknown", + "timeRange": "Day", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/SqlAssessmentV2Operations_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_v2_operations_delete_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_v2_operations_delete_maximum_set_gen.py new file mode 100644 index 000000000000..f52cb92fafd4 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_v2_operations_delete_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python sql_assessment_v2_operations_delete_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + client.sql_assessment_v2_operations.delete( + resource_group_name="rgmigrate", + project_name="fci-test6904project", + group_name="test_fci_hadr", + assessment_name="test_swagger_1", + ) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/SqlAssessmentV2Operations_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_v2_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_v2_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..3b2671056809 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_v2_operations_get_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python sql_assessment_v2_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.sql_assessment_v2_operations.get( + resource_group_name="rgmigrate", + project_name="fci-test6904project", + group_name="test_fci_hadr", + assessment_name="test_swagger_1", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/SqlAssessmentV2Operations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_v2_operations_list_by_group_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_v2_operations_list_by_group_maximum_set_gen.py new file mode 100644 index 000000000000..5bfaa49ab86a --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_v2_operations_list_by_group_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python sql_assessment_v2_operations_list_by_group_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.sql_assessment_v2_operations.list_by_group( + resource_group_name="rgmigrate", + project_name="fci-test6904project", + group_name="test_fci_hadr", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/SqlAssessmentV2Operations_ListByGroup_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_v2_summary_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_v2_summary_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..e123f52c2b14 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_v2_summary_operations_get_maximum_set_gen.py @@ -0,0 +1,45 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python sql_assessment_v2_summary_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.sql_assessment_v2_summary_operations.get( + resource_group_name="rgmigrate", + project_name="fci-test6904project", + group_name="test_fci_hadr", + assessment_name="test_swagger_1", + summary_name="default", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/SqlAssessmentV2SummaryOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_v2_summary_operations_list_by_sql_assessment_v2_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_v2_summary_operations_list_by_sql_assessment_v2_maximum_set_gen.py new file mode 100644 index 000000000000..1f9d8a4936e9 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_assessment_v2_summary_operations_list_by_sql_assessment_v2_maximum_set_gen.py @@ -0,0 +1,45 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python sql_assessment_v2_summary_operations_list_by_sql_assessment_v2_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.sql_assessment_v2_summary_operations.list_by_sql_assessment_v2( + resource_group_name="rgmigrate", + project_name="fci-test6904project", + group_name="test_fci_hadr", + assessment_name="test_swagger_1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/SqlAssessmentV2SummaryOperations_ListBySqlAssessmentV2_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_collector_operations_create_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_collector_operations_create_maximum_set_gen.py new file mode 100644 index 000000000000..2d01ad729359 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_collector_operations_create_maximum_set_gen.py @@ -0,0 +1,60 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python sql_collector_operations_create_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.sql_collector_operations.begin_create( + resource_group_name="rgmigrate", + project_name="fci-test6904project", + collector_name="fci-test0c1esqlsitecollector", + resource={ + "properties": { + "agentProperties": { + "id": "630da710-4d44-41f7-a189-72fe3db5502b-agent", + "lastHeartbeatUtc": None, + "spnDetails": { + "applicationId": "db9c4c3d-477c-4d5a-817b-318276713565", + "audience": "db9c4c3d-477c-4d5a-817b-318276713565", + "authority": "https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47", + "objectId": "e50236ad-ad07-47d4-af71-ed7b52d200d5", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + }, + "version": None, + }, + "discoverySiteId": "/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/bansalankit-rg/providers/Microsoft.OffAzure/MasterSites/fci-ankit-test6065mastersite/SqlSites/fci-ankit-test6065sqlsites", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/SqlCollectorOperations_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_collector_operations_delete_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_collector_operations_delete_maximum_set_gen.py new file mode 100644 index 000000000000..08535c8bfac5 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_collector_operations_delete_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python sql_collector_operations_delete_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + client.sql_collector_operations.delete( + resource_group_name="rgmigrate", + project_name="fci-test6904project", + collector_name="fci-test0c1esqlsitecollector", + ) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/SqlCollectorOperations_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_collector_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_collector_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..c5330217de62 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_collector_operations_get_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python sql_collector_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.sql_collector_operations.get( + resource_group_name="rgmigrate", + project_name="fci-test6904project", + collector_name="fci-test0c1esqlsitecollector", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/SqlCollectorOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_collector_operations_list_by_assessment_project_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_collector_operations_list_by_assessment_project_maximum_set_gen.py new file mode 100644 index 000000000000..14dc920dc70d --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/sql_collector_operations_list_by_assessment_project_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python sql_collector_operations_list_by_assessment_project_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.sql_collector_operations.list_by_assessment_project( + resource_group_name="rgmigrate", + project_name="fci-test6904project", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/SqlCollectorOperations_ListByAssessmentProject_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/vmware_collectors_operations_create_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/vmware_collectors_operations_create_maximum_set_gen.py new file mode 100644 index 000000000000..b42fd160d252 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/vmware_collectors_operations_create_maximum_set_gen.py @@ -0,0 +1,61 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python vmware_collectors_operations_create_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.vmware_collectors_operations.begin_create( + resource_group_name="ayagrawRG", + project_name="app18700project", + vm_ware_collector_name="Vmware2258collector", + resource={ + "properties": { + "agentProperties": { + "id": "fe243486-3318-41fa-aaba-c48b5df75308", + "lastHeartbeatUtc": "2022-03-29T12:10:08.9167289Z", + "spnDetails": { + "applicationId": "82b3e452-c0e8-4662-8347-58282925ae84", + "audience": "82b3e452-c0e8-4662-8347-58282925ae84", + "authority": "https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47", + "objectId": "3fc89111-1405-4938-9214-37aa4739401d", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + }, + "version": "1.0.8.383", + }, + "discoverySiteId": "/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/ayagrawRG/providers/Microsoft.OffAzure/VMwareSites/Vmware2744site", + "provisioningState": "Succeeded", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/VmwareCollectorsOperations_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/vmware_collectors_operations_delete_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/vmware_collectors_operations_delete_maximum_set_gen.py new file mode 100644 index 000000000000..7f01814cdb5e --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/vmware_collectors_operations_delete_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python vmware_collectors_operations_delete_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + client.vmware_collectors_operations.delete( + resource_group_name="ayagrawRG", + project_name="app18700project", + vm_ware_collector_name="Vmware2258collector", + ) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/VmwareCollectorsOperations_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/vmware_collectors_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/vmware_collectors_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..5a3d89f48e5f --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/vmware_collectors_operations_get_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python vmware_collectors_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.vmware_collectors_operations.get( + resource_group_name="ayagrawRG", + project_name="app18700project", + vm_ware_collector_name="Vmware2258collector", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/VmwareCollectorsOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/vmware_collectors_operations_list_by_assessment_project_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/vmware_collectors_operations_list_by_assessment_project_maximum_set_gen.py new file mode 100644 index 000000000000..637f5fce6f5e --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/vmware_collectors_operations_list_by_assessment_project_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python vmware_collectors_operations_list_by_assessment_project_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", + ) + + response = client.vmware_collectors_operations.list_by_assessment_project( + resource_group_name="ayagrawRG", + project_name="app18700project", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/VmwareCollectorsOperations_ListByAssessmentProject_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_options_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_options_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..6545d0e100c7 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_options_operations_get_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python web_app_assessment_options_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="6D59B561-47B6-4AB8-84B5-39CF2B808C26", + ) + + response = client.web_app_assessment_options_operations.get( + resource_group_name="rgopenapi", + project_name="sumukk-ccy-bcs4557project", + assessment_options_name="default", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/WebAppAssessmentOptionsOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_options_operations_list_by_assessment_project_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_options_operations_list_by_assessment_project_maximum_set_gen.py new file mode 100644 index 000000000000..9c25532f6c81 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_options_operations_list_by_assessment_project_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python web_app_assessment_options_operations_list_by_assessment_project_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="92EA264C-A8A7-4192-A5E5-D9B487409240", + ) + + response = client.web_app_assessment_options_operations.list_by_assessment_project( + resource_group_name="rgopenapi", + project_name="sumukk-ccy-bcs", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/WebAppAssessmentOptionsOperations_ListByAssessmentProject_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_v2_operations_create_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_v2_operations_create_maximum_set_gen.py new file mode 100644 index 000000000000..4d23463ceb72 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_v2_operations_create_maximum_set_gen.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python web_app_assessment_v2_operations_create_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="6D59B561-47B6-4AB8-84B5-39CF2B808C26", + ) + + response = client.web_app_assessment_v2_operations.begin_create( + resource_group_name="rgopenapi", + project_name="sumukk-ccy-bcs4557project", + group_name="anraghun-selfhost-v2", + assessment_name="anraghun-selfhost-v2", + resource={ + "properties": { + "appSvcContainerSettings": {"isolationRequired": True}, + "appSvcNativeSettings": {"isolationRequired": True}, + "assessmentType": "WebAppAssessment", + "azureLocation": "UkWest", + "azureOfferCode": "MSAZR0003P", + "azureSecurityOfferingType": "NO", + "confidenceRatingInPercentage": 13, + "currency": "USD", + "discountPercentage": 13, + "discoveredEntityLightSummary": {"numberOfMachines": 27, "numberOfServers": 5, "numberOfWebApps": 23}, + "eaSubscriptionId": "", + "entityUptime": {"daysPerMonth": 18, "hoursPerDay": 13}, + "environmentType": "Production", + "groupType": "Default", + "percentile": "Percentile50", + "perfDataEndTime": "2023-11-03T05:42:45.496Z", + "perfDataStartTime": "2023-11-03T05:42:45.496Z", + "reservedInstance": "None", + "scalingFactor": 17, + "sizingCriterion": "PerformanceBased", + "stage": "InProgress", + "status": "Created", + "timeRange": "Day", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/WebAppAssessmentV2Operations_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_v2_operations_delete_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_v2_operations_delete_maximum_set_gen.py new file mode 100644 index 000000000000..6e8defaee503 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_v2_operations_delete_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python web_app_assessment_v2_operations_delete_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="6D59B561-47B6-4AB8-84B5-39CF2B808C26", + ) + + client.web_app_assessment_v2_operations.delete( + resource_group_name="rgopenapi", + project_name="sumukk-ccy-bcs4557project", + group_name="anraghun-selfhost-v2", + assessment_name="anraghun-selfhost-v2", + ) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/WebAppAssessmentV2Operations_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_v2_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_v2_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..99769e50e285 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_v2_operations_get_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python web_app_assessment_v2_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="6D59B561-47B6-4AB8-84B5-39CF2B808C26", + ) + + response = client.web_app_assessment_v2_operations.get( + resource_group_name="rgopenapi", + project_name="sumukk-ccy-bcs4557project", + group_name="anraghun-selfhost-v2", + assessment_name="anraghun-v2-test", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/WebAppAssessmentV2Operations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_v2_operations_list_by_group_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_v2_operations_list_by_group_maximum_set_gen.py new file mode 100644 index 000000000000..d5cc27d33458 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_v2_operations_list_by_group_maximum_set_gen.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python web_app_assessment_v2_operations_list_by_group_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="6D59B561-47B6-4AB8-84B5-39CF2B808C26", + ) + + response = client.web_app_assessment_v2_operations.list_by_group( + resource_group_name="rgopenapi", + project_name="sumukk-ccy-bcs4557project", + group_name="anraghun-selfhost-v2", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/WebAppAssessmentV2Operations_ListByGroup_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_v2_summary_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_v2_summary_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..06c574e25377 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_v2_summary_operations_get_maximum_set_gen.py @@ -0,0 +1,45 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python web_app_assessment_v2_summary_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="6D59B561-47B6-4AB8-84B5-39CF2B808C26", + ) + + response = client.web_app_assessment_v2_summary_operations.get( + resource_group_name="rgopenapi", + project_name="sumukk-ccy-bcs4557project", + group_name="anraghun-selfhost-v2", + assessment_name="anraghun-selfhost-v2", + summary_name="default", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/WebAppAssessmentV2SummaryOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_v2_summary_operations_list_by_web_app_assessment_v2_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_v2_summary_operations_list_by_web_app_assessment_v2_maximum_set_gen.py new file mode 100644 index 000000000000..31412b498471 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_assessment_v2_summary_operations_list_by_web_app_assessment_v2_maximum_set_gen.py @@ -0,0 +1,45 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python web_app_assessment_v2_summary_operations_list_by_web_app_assessment_v2_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="6D59B561-47B6-4AB8-84B5-39CF2B808C26", + ) + + response = client.web_app_assessment_v2_summary_operations.list_by_web_app_assessment_v2( + resource_group_name="rgopenapi", + project_name="sumukk-ccy-bcs4557project", + group_name="anraghun-selfhost-v2", + assessment_name="anraghun-selfhost-v2", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/WebAppAssessmentV2SummaryOperations_ListByWebAppAssessmentV2_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_collector_operations_create_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_collector_operations_create_maximum_set_gen.py new file mode 100644 index 000000000000..5fed8dedf425 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_collector_operations_create_maximum_set_gen.py @@ -0,0 +1,60 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python web_app_collector_operations_create_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="6D59B561-47B6-4AB8-84B5-39CF2B808C26", + ) + + response = client.web_app_collector_operations.begin_create( + resource_group_name="rgopenapi", + project_name="sumukk-ccy-bcs4557project", + collector_name="collector1", + resource={ + "properties": { + "agentProperties": { + "id": "fed93df5-b787-4e3f-a764-e3d2b9101a59-agent", + "lastHeartbeatUtc": "2023-11-03T05:43:02.078Z", + "spnDetails": { + "applicationId": "2f70d5e8-7adc-4c64-910a-7031079efc6e", + "audience": "2f70d5e8-7adc-4c64-910a-7031079efc6e", + "authority": "https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47", + "objectId": "2f70d5e8-7adc-4c64-910a-7031079efc6e", + "tenantId": "2f70d5e8-7adc-4c64-910a-7031079efc6e", + }, + "version": None, + }, + "discoverySiteId": "/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/sumukk-ccy-bcs/providers/Microsoft.OffAzure/MasterSites/sumukk-ccy-bcs9880mastersite/WebAppSites/sumukk-ccy-bcs9880webappsites", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/WebAppCollectorOperations_Create_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_collector_operations_delete_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_collector_operations_delete_maximum_set_gen.py new file mode 100644 index 000000000000..75258a9f9ba1 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_collector_operations_delete_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python web_app_collector_operations_delete_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="6D59B561-47B6-4AB8-84B5-39CF2B808C26", + ) + + client.web_app_collector_operations.delete( + resource_group_name="rgopenapi", + project_name="sumukk-ccy-bcs4557project", + collector_name="collector1", + ) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/WebAppCollectorOperations_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_collector_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_collector_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..a583acbccfa0 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_collector_operations_get_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python web_app_collector_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="6D59B561-47B6-4AB8-84B5-39CF2B808C26", + ) + + response = client.web_app_collector_operations.get( + resource_group_name="rgopenapi", + project_name="sumukk-ccy-bcs4557project", + collector_name="collector1", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/WebAppCollectorOperations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_collector_operations_list_by_assessment_project_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_collector_operations_list_by_assessment_project_maximum_set_gen.py new file mode 100644 index 000000000000..7657a364f4c1 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_collector_operations_list_by_assessment_project_maximum_set_gen.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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python web_app_collector_operations_list_by_assessment_project_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="6D59B561-47B6-4AB8-84B5-39CF2B808C26", + ) + + response = client.web_app_collector_operations.list_by_assessment_project( + resource_group_name="rgopenapi", + project_name="sumukk-ccy-bcs4557project", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/WebAppCollectorOperations_ListByAssessmentProject_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_service_plan_v2_operations_get_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_service_plan_v2_operations_get_maximum_set_gen.py new file mode 100644 index 000000000000..9e41661a3bfe --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_service_plan_v2_operations_get_maximum_set_gen.py @@ -0,0 +1,45 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python web_app_service_plan_v2_operations_get_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="6D59B561-47B6-4AB8-84B5-39CF2B808C26", + ) + + response = client.web_app_service_plan_v2_operations.get( + resource_group_name="rgopenapi", + project_name="sumukk-ccy-bcs4557project", + group_name="anraghun-selfhost-v2", + assessment_name="anraghun-selfhost-v2", + web_app_service_plan_name="plan-001", + ) + print(response) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/WebAppServicePlanV2Operations_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_service_plan_v2_operations_list_by_web_app_assessment_v2_maximum_set_gen.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_service_plan_v2_operations_list_by_web_app_assessment_v2_maximum_set_gen.py new file mode 100644 index 000000000000..a7e012992b9c --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_samples/web_app_service_plan_v2_operations_list_by_web_app_assessment_v2_maximum_set_gen.py @@ -0,0 +1,45 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-migrationassessment +# USAGE + python web_app_service_plan_v2_operations_list_by_web_app_assessment_v2_maximum_set_gen.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 = AzureMigrateAssessmentService( + credential=DefaultAzureCredential(), + subscription_id="6D59B561-47B6-4AB8-84B5-39CF2B808C26", + ) + + response = client.web_app_service_plan_v2_operations.list_by_web_app_assessment_v2( + resource_group_name="rgopenapi", + project_name="sumukk-ccy-bcs4557project", + group_name="anraghun-selfhost-v2", + assessment_name="anraghun-selfhost-v2", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/migrate/resource-manager/Microsoft.Migrate/AssessmentProjects/preview/2024-01-01-preview/examples/WebAppServicePlanV2Operations_ListByWebAppAssessmentV2_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/conftest.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/conftest.py new file mode 100644 index 000000000000..4965d4633ffc --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/conftest.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# For security, please avoid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + azuremigrateassessmentservice_subscription_id = os.environ.get( + "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + azuremigrateassessmentservice_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + azuremigrateassessmentservice_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + azuremigrateassessmentservice_client_secret = os.environ.get( + "AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=azuremigrateassessmentservice_subscription_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=azuremigrateassessmentservice_tenant_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=azuremigrateassessmentservice_client_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=azuremigrateassessmentservice_client_secret, value="00000000-0000-0000-0000-000000000000" + ) + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_assessment_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_assessment_operations_operations.py new file mode 100644 index 000000000000..991415c25c3e --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_assessment_operations_operations.py @@ -0,0 +1,132 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAksAssessmentOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_aks_assessment_operations_list_by_assessment_project(self, resource_group): + response = self.client.aks_assessment_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_aks_assessment_operations_get(self, resource_group): + response = self.client.aks_assessment_operations.get( + resource_group_name=resource_group.name, + project_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_aks_assessment_operations_begin_create(self, resource_group): + response = self.client.aks_assessment_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + assessment_name="str", + resource={ + "eTag": "str", + "id": "str", + "name": "str", + "properties": { + "settings": { + "azureLocation": "str", + "category": "str", + "consolidation": "str", + "currency": "str", + "environmentType": "str", + "licensingProgram": "str", + "pricingTier": "str", + "savingsOptions": "str", + "sizingCriteria": "str", + "discountPercentage": 0.0, + "performanceData": { + "percentile": "str", + "timeRange": "str", + "perfDataEndTime": "2020-02-20 00:00:00", + "perfDataStartTime": "2020-02-20 00:00:00", + }, + "scalingFactor": 0.0, + }, + "details": { + "createdTimestamp": "2020-02-20 00:00:00", + "machineCount": 0, + "status": "str", + "totalMonthlyCost": 0.0, + "updatedTimestamp": "2020-02-20 00:00:00", + "webAppCount": 0, + "webServerCount": 0, + "confidenceRatingInPercentage": 0.0, + "pricesTimestamp": "2020-02-20 00:00:00", + }, + "provisioningState": "str", + "scope": {"serverGroupId": "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-01-01-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_aks_assessment_operations_delete(self, resource_group): + response = self.client.aks_assessment_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_aks_assessment_operations_begin_download_url(self, resource_group): + response = self.client.aks_assessment_operations.begin_download_url( + resource_group_name=resource_group.name, + project_name="str", + assessment_name="str", + body={}, + api_version="2024-01-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_assessment_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_assessment_operations_operations_async.py new file mode 100644 index 000000000000..02ac7e499138 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_assessment_operations_operations_async.py @@ -0,0 +1,137 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAksAssessmentOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_aks_assessment_operations_list_by_assessment_project(self, resource_group): + response = self.client.aks_assessment_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-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_aks_assessment_operations_get(self, resource_group): + response = await self.client.aks_assessment_operations.get( + resource_group_name=resource_group.name, + project_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_aks_assessment_operations_begin_create(self, resource_group): + response = await ( + await self.client.aks_assessment_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + assessment_name="str", + resource={ + "eTag": "str", + "id": "str", + "name": "str", + "properties": { + "settings": { + "azureLocation": "str", + "category": "str", + "consolidation": "str", + "currency": "str", + "environmentType": "str", + "licensingProgram": "str", + "pricingTier": "str", + "savingsOptions": "str", + "sizingCriteria": "str", + "discountPercentage": 0.0, + "performanceData": { + "percentile": "str", + "timeRange": "str", + "perfDataEndTime": "2020-02-20 00:00:00", + "perfDataStartTime": "2020-02-20 00:00:00", + }, + "scalingFactor": 0.0, + }, + "details": { + "createdTimestamp": "2020-02-20 00:00:00", + "machineCount": 0, + "status": "str", + "totalMonthlyCost": 0.0, + "updatedTimestamp": "2020-02-20 00:00:00", + "webAppCount": 0, + "webServerCount": 0, + "confidenceRatingInPercentage": 0.0, + "pricesTimestamp": "2020-02-20 00:00:00", + }, + "provisioningState": "str", + "scope": {"serverGroupId": "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-01-01-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_aks_assessment_operations_delete(self, resource_group): + response = await self.client.aks_assessment_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_aks_assessment_operations_begin_download_url(self, resource_group): + response = await ( + await self.client.aks_assessment_operations.begin_download_url( + resource_group_name=resource_group.name, + project_name="str", + assessment_name="str", + body={}, + api_version="2024-01-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_cluster_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_cluster_operations_operations.py new file mode 100644 index 000000000000..cfcc5c91adf1 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_cluster_operations_operations.py @@ -0,0 +1,46 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAksClusterOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_aks_cluster_operations_list_by_aks_assessment(self, resource_group): + response = self.client.aks_cluster_operations.list_by_aks_assessment( + resource_group_name=resource_group.name, + project_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_aks_cluster_operations_get(self, resource_group): + response = self.client.aks_cluster_operations.get( + resource_group_name=resource_group.name, + project_name="str", + assessment_name="str", + cluster_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_cluster_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_cluster_operations_operations_async.py new file mode 100644 index 000000000000..888629b3e698 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_cluster_operations_operations_async.py @@ -0,0 +1,47 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAksClusterOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_aks_cluster_operations_list_by_aks_assessment(self, resource_group): + response = self.client.aks_cluster_operations.list_by_aks_assessment( + resource_group_name=resource_group.name, + project_name="str", + assessment_name="str", + api_version="2024-01-01-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_aks_cluster_operations_get(self, resource_group): + response = await self.client.aks_cluster_operations.get( + resource_group_name=resource_group.name, + project_name="str", + assessment_name="str", + cluster_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_cost_detail_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_cost_detail_operations_operations.py new file mode 100644 index 000000000000..dc398b463f31 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_cost_detail_operations_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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAksCostDetailOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_aks_cost_detail_operations_list_by_aks_assessment(self, resource_group): + response = self.client.aks_cost_detail_operations.list_by_aks_assessment( + resource_group_name=resource_group.name, + project_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_cost_detail_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_cost_detail_operations_operations_async.py new file mode 100644 index 000000000000..f62a6fe75b62 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_cost_detail_operations_operations_async.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAksCostDetailOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_aks_cost_detail_operations_list_by_aks_assessment(self, resource_group): + response = self.client.aks_cost_detail_operations.list_by_aks_assessment( + resource_group_name=resource_group.name, + project_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_options_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_options_operations_operations.py new file mode 100644 index 000000000000..9e574e57bb4e --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_options_operations_operations.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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAksOptionsOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_aks_options_operations_list_by_assessment_project(self, resource_group): + response = self.client.aks_options_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_aks_options_operations_get(self, resource_group): + response = self.client.aks_options_operations.get( + resource_group_name=resource_group.name, + project_name="str", + assessment_options_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_options_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_options_operations_operations_async.py new file mode 100644 index 000000000000..53e918bcd88c --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_options_operations_operations_async.py @@ -0,0 +1,45 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAksOptionsOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_aks_options_operations_list_by_assessment_project(self, resource_group): + response = self.client.aks_options_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-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_aks_options_operations_get(self, resource_group): + response = await self.client.aks_options_operations.get( + resource_group_name=resource_group.name, + project_name="str", + assessment_options_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_summary_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_summary_operations_operations.py new file mode 100644 index 000000000000..852c8de6ba22 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_summary_operations_operations.py @@ -0,0 +1,46 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAksSummaryOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_aks_summary_operations_list_by_aks_assessment(self, resource_group): + response = self.client.aks_summary_operations.list_by_aks_assessment( + resource_group_name=resource_group.name, + project_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_aks_summary_operations_get(self, resource_group): + response = self.client.aks_summary_operations.get( + resource_group_name=resource_group.name, + project_name="str", + assessment_name="str", + summary_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_summary_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_summary_operations_operations_async.py new file mode 100644 index 000000000000..45f7ff34994c --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_aks_summary_operations_operations_async.py @@ -0,0 +1,47 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAksSummaryOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_aks_summary_operations_list_by_aks_assessment(self, resource_group): + response = self.client.aks_summary_operations.list_by_aks_assessment( + resource_group_name=resource_group.name, + project_name="str", + assessment_name="str", + api_version="2024-01-01-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_aks_summary_operations_get(self, resource_group): + response = await self.client.aks_summary_operations.get( + resource_group_name=resource_group.name, + project_name="str", + assessment_name="str", + summary_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_machines_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_machines_operations_operations.py new file mode 100644 index 000000000000..a60648b4cead --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_machines_operations_operations.py @@ -0,0 +1,48 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAssessedMachinesOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessed_machines_operations_list_by_assessment(self, resource_group): + response = self.client.assessed_machines_operations.list_by_assessment( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessed_machines_operations_get(self, resource_group): + response = self.client.assessed_machines_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + assessed_machine_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_machines_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_machines_operations_operations_async.py new file mode 100644 index 000000000000..1b8cf588d8ff --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_machines_operations_operations_async.py @@ -0,0 +1,49 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAssessedMachinesOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_assessed_machines_operations_list_by_assessment(self, resource_group): + response = self.client.assessed_machines_operations.list_by_assessment( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-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_assessed_machines_operations_get(self, resource_group): + response = await self.client.assessed_machines_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + assessed_machine_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_database_v2_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_database_v2_operations_operations.py new file mode 100644 index 000000000000..d85a369bf9b9 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_database_v2_operations_operations.py @@ -0,0 +1,48 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAssessedSqlDatabaseV2OperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessed_sql_database_v2_operations_list_by_sql_assessment_v2(self, resource_group): + response = self.client.assessed_sql_database_v2_operations.list_by_sql_assessment_v2( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessed_sql_database_v2_operations_get(self, resource_group): + response = self.client.assessed_sql_database_v2_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + assessed_sql_database_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_database_v2_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_database_v2_operations_operations_async.py new file mode 100644 index 000000000000..6849974b7ff3 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_database_v2_operations_operations_async.py @@ -0,0 +1,49 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAssessedSqlDatabaseV2OperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_assessed_sql_database_v2_operations_list_by_sql_assessment_v2(self, resource_group): + response = self.client.assessed_sql_database_v2_operations.list_by_sql_assessment_v2( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-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_assessed_sql_database_v2_operations_get(self, resource_group): + response = await self.client.assessed_sql_database_v2_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + assessed_sql_database_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_instance_v2_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_instance_v2_operations_operations.py new file mode 100644 index 000000000000..7fb7d850350d --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_instance_v2_operations_operations.py @@ -0,0 +1,48 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAssessedSqlInstanceV2OperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessed_sql_instance_v2_operations_list_by_sql_assessment_v2(self, resource_group): + response = self.client.assessed_sql_instance_v2_operations.list_by_sql_assessment_v2( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessed_sql_instance_v2_operations_get(self, resource_group): + response = self.client.assessed_sql_instance_v2_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + assessed_sql_instance_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_instance_v2_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_instance_v2_operations_operations_async.py new file mode 100644 index 000000000000..1b838772f287 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_instance_v2_operations_operations_async.py @@ -0,0 +1,49 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAssessedSqlInstanceV2OperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_assessed_sql_instance_v2_operations_list_by_sql_assessment_v2(self, resource_group): + response = self.client.assessed_sql_instance_v2_operations.list_by_sql_assessment_v2( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-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_assessed_sql_instance_v2_operations_get(self, resource_group): + response = await self.client.assessed_sql_instance_v2_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + assessed_sql_instance_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_machines_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_machines_operations_operations.py new file mode 100644 index 000000000000..324f9508a787 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_machines_operations_operations.py @@ -0,0 +1,48 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAssessedSqlMachinesOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessed_sql_machines_operations_list_by_sql_assessment_v2(self, resource_group): + response = self.client.assessed_sql_machines_operations.list_by_sql_assessment_v2( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessed_sql_machines_operations_get(self, resource_group): + response = self.client.assessed_sql_machines_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + assessed_sql_machine_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_machines_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_machines_operations_operations_async.py new file mode 100644 index 000000000000..a95b8c8e6ef8 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_machines_operations_operations_async.py @@ -0,0 +1,49 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAssessedSqlMachinesOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_assessed_sql_machines_operations_list_by_sql_assessment_v2(self, resource_group): + response = self.client.assessed_sql_machines_operations.list_by_sql_assessment_v2( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-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_assessed_sql_machines_operations_get(self, resource_group): + response = await self.client.assessed_sql_machines_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + assessed_sql_machine_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_recommended_entity_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_recommended_entity_operations_operations.py new file mode 100644 index 000000000000..ac4c9bd46692 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_recommended_entity_operations_operations.py @@ -0,0 +1,48 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAssessedSqlRecommendedEntityOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessed_sql_recommended_entity_operations_list_by_sql_assessment_v2(self, resource_group): + response = self.client.assessed_sql_recommended_entity_operations.list_by_sql_assessment_v2( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessed_sql_recommended_entity_operations_get(self, resource_group): + response = self.client.assessed_sql_recommended_entity_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + recommended_assessed_entity_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_recommended_entity_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_recommended_entity_operations_operations_async.py new file mode 100644 index 000000000000..27ab2078c6f9 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_sql_recommended_entity_operations_operations_async.py @@ -0,0 +1,49 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAssessedSqlRecommendedEntityOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_assessed_sql_recommended_entity_operations_list_by_sql_assessment_v2(self, resource_group): + response = self.client.assessed_sql_recommended_entity_operations.list_by_sql_assessment_v2( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-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_assessed_sql_recommended_entity_operations_get(self, resource_group): + response = await self.client.assessed_sql_recommended_entity_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + recommended_assessed_entity_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_web_app_v2_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_web_app_v2_operations_operations.py new file mode 100644 index 000000000000..6a6d7e1ff139 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_web_app_v2_operations_operations.py @@ -0,0 +1,48 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAssessedWebAppV2OperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessed_web_app_v2_operations_list_by_web_app_assessment_v2(self, resource_group): + response = self.client.assessed_web_app_v2_operations.list_by_web_app_assessment_v2( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessed_web_app_v2_operations_get(self, resource_group): + response = self.client.assessed_web_app_v2_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + assessed_web_app_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_web_app_v2_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_web_app_v2_operations_operations_async.py new file mode 100644 index 000000000000..a4a428b964d2 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_web_app_v2_operations_operations_async.py @@ -0,0 +1,49 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAssessedWebAppV2OperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_assessed_web_app_v2_operations_list_by_web_app_assessment_v2(self, resource_group): + response = self.client.assessed_web_app_v2_operations.list_by_web_app_assessment_v2( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-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_assessed_web_app_v2_operations_get(self, resource_group): + response = await self.client.assessed_web_app_v2_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + assessed_web_app_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_web_application_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_web_application_operations_operations.py new file mode 100644 index 000000000000..7608604093e6 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_web_application_operations_operations.py @@ -0,0 +1,46 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAssessedWebApplicationOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessed_web_application_operations_list_by_aks_assessment(self, resource_group): + response = self.client.assessed_web_application_operations.list_by_aks_assessment( + resource_group_name=resource_group.name, + project_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessed_web_application_operations_get(self, resource_group): + response = self.client.assessed_web_application_operations.get( + resource_group_name=resource_group.name, + project_name="str", + assessment_name="str", + assessed_workload="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_web_application_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_web_application_operations_operations_async.py new file mode 100644 index 000000000000..45d05edf7450 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessed_web_application_operations_operations_async.py @@ -0,0 +1,47 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAssessedWebApplicationOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_assessed_web_application_operations_list_by_aks_assessment(self, resource_group): + response = self.client.assessed_web_application_operations.list_by_aks_assessment( + resource_group_name=resource_group.name, + project_name="str", + assessment_name="str", + api_version="2024-01-01-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_assessed_web_application_operations_get(self, resource_group): + response = await self.client.assessed_web_application_operations.get( + resource_group_name=resource_group.name, + project_name="str", + assessment_name="str", + assessed_workload="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessment_options_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessment_options_operations_operations.py new file mode 100644 index 000000000000..567d80dbe99c --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessment_options_operations_operations.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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAssessmentOptionsOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessment_options_operations_list_by_assessment_project(self, resource_group): + response = self.client.assessment_options_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessment_options_operations_get(self, resource_group): + response = self.client.assessment_options_operations.get( + resource_group_name=resource_group.name, + project_name="str", + assessment_options_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessment_options_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessment_options_operations_operations_async.py new file mode 100644 index 000000000000..933315f64471 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessment_options_operations_operations_async.py @@ -0,0 +1,45 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAssessmentOptionsOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_assessment_options_operations_list_by_assessment_project(self, resource_group): + response = self.client.assessment_options_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-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_assessment_options_operations_get(self, resource_group): + response = await self.client.assessment_options_operations.get( + resource_group_name=resource_group.name, + project_name="str", + assessment_options_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessment_project_summary_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessment_project_summary_operations_operations.py new file mode 100644 index 000000000000..f10eb538be7f --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessment_project_summary_operations_operations.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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAssessmentProjectSummaryOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessment_project_summary_operations_list_by_assessment_project(self, resource_group): + response = self.client.assessment_project_summary_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessment_project_summary_operations_get(self, resource_group): + response = self.client.assessment_project_summary_operations.get( + resource_group_name=resource_group.name, + project_name="str", + project_summary_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessment_project_summary_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessment_project_summary_operations_operations_async.py new file mode 100644 index 000000000000..cab3c9a11ff3 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessment_project_summary_operations_operations_async.py @@ -0,0 +1,45 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAssessmentProjectSummaryOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_assessment_project_summary_operations_list_by_assessment_project(self, resource_group): + response = self.client.assessment_project_summary_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-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_assessment_project_summary_operations_get(self, resource_group): + response = await self.client.assessment_project_summary_operations.get( + resource_group_name=resource_group.name, + project_name="str", + project_summary_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessment_projects_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessment_projects_operations_operations.py new file mode 100644 index 000000000000..163538d61fb0 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessment_projects_operations_operations.py @@ -0,0 +1,152 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAssessmentProjectsOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessment_projects_operations_list_by_subscription(self, resource_group): + response = self.client.assessment_projects_operations.list_by_subscription( + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessment_projects_operations_list_by_resource_group(self, resource_group): + response = self.client.assessment_projects_operations.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessment_projects_operations_get(self, resource_group): + response = self.client.assessment_projects_operations.get( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessment_projects_operations_begin_create(self, resource_group): + response = self.client.assessment_projects_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "assessmentSolutionId": "str", + "createdTimestamp": "2020-02-20 00:00:00", + "customerStorageAccountArmId": "str", + "customerWorkspaceId": "str", + "customerWorkspaceLocation": "str", + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "groupIds": ["str"], + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "projectStatus": "str", + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceEndpoint": "str", + "updatedTimestamp": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-01-01-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_assessment_projects_operations_begin_update(self, resource_group): + response = self.client.assessment_projects_operations.begin_update( + resource_group_name=resource_group.name, + project_name="str", + properties={ + "properties": { + "assessmentSolutionId": "str", + "customerStorageAccountArmId": "str", + "customerWorkspaceId": "str", + "customerWorkspaceLocation": "str", + "projectStatus": "str", + "provisioningState": "str", + "publicNetworkAccess": "str", + }, + "tags": {"str": "str"}, + }, + api_version="2024-01-01-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_assessment_projects_operations_delete(self, resource_group): + response = self.client.assessment_projects_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessment_projects_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessment_projects_operations_operations_async.py new file mode 100644 index 000000000000..9803272bd642 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessment_projects_operations_operations_async.py @@ -0,0 +1,157 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAssessmentProjectsOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_assessment_projects_operations_list_by_subscription(self, resource_group): + response = self.client.assessment_projects_operations.list_by_subscription( + api_version="2024-01-01-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_assessment_projects_operations_list_by_resource_group(self, resource_group): + response = self.client.assessment_projects_operations.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-01-01-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_assessment_projects_operations_get(self, resource_group): + response = await self.client.assessment_projects_operations.get( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_assessment_projects_operations_begin_create(self, resource_group): + response = await ( + await self.client.assessment_projects_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "assessmentSolutionId": "str", + "createdTimestamp": "2020-02-20 00:00:00", + "customerStorageAccountArmId": "str", + "customerWorkspaceId": "str", + "customerWorkspaceLocation": "str", + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "groupIds": ["str"], + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "projectStatus": "str", + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceEndpoint": "str", + "updatedTimestamp": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-01-01-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_assessment_projects_operations_begin_update(self, resource_group): + response = await ( + await self.client.assessment_projects_operations.begin_update( + resource_group_name=resource_group.name, + project_name="str", + properties={ + "properties": { + "assessmentSolutionId": "str", + "customerStorageAccountArmId": "str", + "customerWorkspaceId": "str", + "customerWorkspaceLocation": "str", + "projectStatus": "str", + "provisioningState": "str", + "publicNetworkAccess": "str", + }, + "tags": {"str": "str"}, + }, + api_version="2024-01-01-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_assessment_projects_operations_delete(self, resource_group): + response = await self.client.assessment_projects_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessments_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessments_operations_operations.py new file mode 100644 index 000000000000..96677bce850f --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessments_operations_operations.py @@ -0,0 +1,146 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAssessmentsOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessments_operations_list_by_group(self, resource_group): + response = self.client.assessments_operations.list_by_group( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessments_operations_get(self, resource_group): + response = self.client.assessments_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessments_operations_begin_create(self, resource_group): + response = self.client.assessments_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "assessmentErrorSummary": {"str": 0}, + "assessmentType": "str", + "azureDiskTypes": ["str"], + "azureHybridUseBenefit": "str", + "azureLocation": "str", + "azureOfferCode": "str", + "azurePricingTier": "str", + "azureStorageRedundancy": "str", + "azureVmFamilies": ["str"], + "confidenceRatingInPercentage": 0.0, + "costComponents": [{"description": "str", "name": "str", "value": 0.0}], + "createdTimestamp": "2020-02-20 00:00:00", + "currency": "str", + "discountPercentage": 0.0, + "distributionByOsName": {"str": 0}, + "distributionByServicePackInsight": {"str": 0}, + "distributionBySupportStatus": {"str": 0}, + "eaSubscriptionId": "str", + "groupType": "str", + "linuxAzureHybridUseBenefit": "str", + "monthlyBandwidthCost": 0.0, + "monthlyComputeCost": 0.0, + "monthlyPremiumStorageCost": 0.0, + "monthlyStandardSsdStorageCost": 0.0, + "monthlyStorageCost": 0.0, + "monthlyUltraStorageCost": 0.0, + "numberOfMachines": 0, + "percentile": "str", + "perfDataEndTime": "2020-02-20 00:00:00", + "perfDataStartTime": "2020-02-20 00:00:00", + "pricesTimestamp": "2020-02-20 00:00:00", + "provisioningState": "str", + "reservedInstance": "str", + "scalingFactor": 0.0, + "schemaVersion": "str", + "sizingCriterion": "str", + "stage": "str", + "status": "str", + "suitabilitySummary": {"str": 0}, + "timeRange": "str", + "updatedTimestamp": "2020-02-20 00:00:00", + "vmUptime": {"daysPerMonth": 0, "hoursPerDay": 0}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-01-01-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_assessments_operations_delete(self, resource_group): + response = self.client.assessments_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_assessments_operations_begin_download_url(self, resource_group): + response = self.client.assessments_operations.begin_download_url( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + body={}, + api_version="2024-01-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessments_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessments_operations_operations_async.py new file mode 100644 index 000000000000..ea76756fdf6c --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_assessments_operations_operations_async.py @@ -0,0 +1,151 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAssessmentsOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_assessments_operations_list_by_group(self, resource_group): + response = self.client.assessments_operations.list_by_group( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + api_version="2024-01-01-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_assessments_operations_get(self, resource_group): + response = await self.client.assessments_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_assessments_operations_begin_create(self, resource_group): + response = await ( + await self.client.assessments_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "assessmentErrorSummary": {"str": 0}, + "assessmentType": "str", + "azureDiskTypes": ["str"], + "azureHybridUseBenefit": "str", + "azureLocation": "str", + "azureOfferCode": "str", + "azurePricingTier": "str", + "azureStorageRedundancy": "str", + "azureVmFamilies": ["str"], + "confidenceRatingInPercentage": 0.0, + "costComponents": [{"description": "str", "name": "str", "value": 0.0}], + "createdTimestamp": "2020-02-20 00:00:00", + "currency": "str", + "discountPercentage": 0.0, + "distributionByOsName": {"str": 0}, + "distributionByServicePackInsight": {"str": 0}, + "distributionBySupportStatus": {"str": 0}, + "eaSubscriptionId": "str", + "groupType": "str", + "linuxAzureHybridUseBenefit": "str", + "monthlyBandwidthCost": 0.0, + "monthlyComputeCost": 0.0, + "monthlyPremiumStorageCost": 0.0, + "monthlyStandardSsdStorageCost": 0.0, + "monthlyStorageCost": 0.0, + "monthlyUltraStorageCost": 0.0, + "numberOfMachines": 0, + "percentile": "str", + "perfDataEndTime": "2020-02-20 00:00:00", + "perfDataStartTime": "2020-02-20 00:00:00", + "pricesTimestamp": "2020-02-20 00:00:00", + "provisioningState": "str", + "reservedInstance": "str", + "scalingFactor": 0.0, + "schemaVersion": "str", + "sizingCriterion": "str", + "stage": "str", + "status": "str", + "suitabilitySummary": {"str": 0}, + "timeRange": "str", + "updatedTimestamp": "2020-02-20 00:00:00", + "vmUptime": {"daysPerMonth": 0, "hoursPerDay": 0}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-01-01-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_assessments_operations_delete(self, resource_group): + response = await self.client.assessments_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_assessments_operations_begin_download_url(self, resource_group): + response = await ( + await self.client.assessments_operations.begin_download_url( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + body={}, + api_version="2024-01-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_avs_assessed_machines_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_avs_assessed_machines_operations_operations.py new file mode 100644 index 000000000000..abb1167ec442 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_avs_assessed_machines_operations_operations.py @@ -0,0 +1,48 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAvsAssessedMachinesOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_avs_assessed_machines_operations_list_by_avs_assessment(self, resource_group): + response = self.client.avs_assessed_machines_operations.list_by_avs_assessment( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_avs_assessed_machines_operations_get(self, resource_group): + response = self.client.avs_assessed_machines_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + avs_assessed_machine_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_avs_assessed_machines_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_avs_assessed_machines_operations_operations_async.py new file mode 100644 index 000000000000..68b3e8e87254 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_avs_assessed_machines_operations_operations_async.py @@ -0,0 +1,49 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAvsAssessedMachinesOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_avs_assessed_machines_operations_list_by_avs_assessment(self, resource_group): + response = self.client.avs_assessed_machines_operations.list_by_avs_assessment( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-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_avs_assessed_machines_operations_get(self, resource_group): + response = await self.client.avs_assessed_machines_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + avs_assessed_machine_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_avs_assessment_options_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_avs_assessment_options_operations_operations.py new file mode 100644 index 000000000000..b499efe4524f --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_avs_assessment_options_operations_operations.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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAvsAssessmentOptionsOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_avs_assessment_options_operations_list_by_assessment_project(self, resource_group): + response = self.client.avs_assessment_options_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_avs_assessment_options_operations_get(self, resource_group): + response = self.client.avs_assessment_options_operations.get( + resource_group_name=resource_group.name, + project_name="str", + avs_assessment_options_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_avs_assessment_options_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_avs_assessment_options_operations_operations_async.py new file mode 100644 index 000000000000..68f1b4ad05a4 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_avs_assessment_options_operations_operations_async.py @@ -0,0 +1,45 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAvsAssessmentOptionsOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_avs_assessment_options_operations_list_by_assessment_project(self, resource_group): + response = self.client.avs_assessment_options_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-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_avs_assessment_options_operations_get(self, resource_group): + response = await self.client.avs_assessment_options_operations.get( + resource_group_name=resource_group.name, + project_name="str", + avs_assessment_options_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_avs_assessments_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_avs_assessments_operations_operations.py new file mode 100644 index 000000000000..4f3fbf974660 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_avs_assessments_operations_operations.py @@ -0,0 +1,171 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAvsAssessmentsOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_avs_assessments_operations_list_by_group(self, resource_group): + response = self.client.avs_assessments_operations.list_by_group( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_avs_assessments_operations_get(self, resource_group): + response = self.client.avs_assessments_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_avs_assessments_operations_begin_create(self, resource_group): + response = self.client.avs_assessments_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "assessmentErrorSummary": {"str": 0}, + "assessmentType": "str", + "avsAssessmentScenario": "str", + "avsEstimatedExternalStorages": [ + {"monthlyPrice": 0.0, "storageType": "str", "storageUtilization": 0.0, "totalStorageInGB": 0.0} + ], + "avsEstimatedNetworks": [{"monthlyPrice": 0.0, "networkType": "str"}], + "avsEstimatedNodes": [ + { + "cpuUtilization": 0.0, + "fttRaidLevel": "str", + "monthlyPrice": 0.0, + "nodeNumber": 0, + "nodeType": "str", + "pricingModel": "str", + "ramUtilization": 0.0, + "storageUtilization": 0.0, + "totalCpu": 0.0, + "totalRam": 0.0, + "totalStorage": 0.0, + } + ], + "azureLocation": "str", + "azureOfferCode": "str", + "confidenceRatingInPercentage": 0.0, + "costComponents": [{"description": "str", "name": "str", "value": 0.0}], + "cpuHeadroom": 0.0, + "cpuUtilization": 0.0, + "createdTimestamp": "2020-02-20 00:00:00", + "currency": "str", + "dedupeCompression": 0.0, + "discountPercentage": 0.0, + "externalStorageTypes": ["str"], + "failuresToTolerateAndRaidLevel": "str", + "failuresToTolerateAndRaidLevelList": ["str"], + "groupType": "str", + "isStretchClusterEnabled": bool, + "isVcfByolEnabled": bool, + "limitingFactor": "str", + "memOvercommit": 0.0, + "nodeType": "str", + "nodeTypes": ["str"], + "numberOfMachines": 0, + "numberOfNodes": 0, + "percentile": "str", + "perfDataEndTime": "2020-02-20 00:00:00", + "perfDataStartTime": "2020-02-20 00:00:00", + "pricesTimestamp": "2020-02-20 00:00:00", + "provisioningState": "str", + "ramUtilization": 0.0, + "reservedInstance": "str", + "scalingFactor": 0.0, + "schemaVersion": "str", + "sizingCriterion": "str", + "stage": "str", + "status": "str", + "storageUtilization": 0.0, + "suitability": "str", + "suitabilityExplanation": "str", + "suitabilitySummary": {"str": 0}, + "timeRange": "str", + "totalCpuCores": 0.0, + "totalMonthlyCost": 0.0, + "totalRamInGB": 0.0, + "totalStorageInGB": 0.0, + "updatedTimestamp": "2020-02-20 00:00:00", + "vcpuOversubscription": 0.0, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-01-01-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_avs_assessments_operations_delete(self, resource_group): + response = self.client.avs_assessments_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_avs_assessments_operations_begin_download_url(self, resource_group): + response = self.client.avs_assessments_operations.begin_download_url( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + body={}, + api_version="2024-01-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_avs_assessments_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_avs_assessments_operations_operations_async.py new file mode 100644 index 000000000000..ebb7d38cdb97 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_avs_assessments_operations_operations_async.py @@ -0,0 +1,181 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceAvsAssessmentsOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_avs_assessments_operations_list_by_group(self, resource_group): + response = self.client.avs_assessments_operations.list_by_group( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + api_version="2024-01-01-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_avs_assessments_operations_get(self, resource_group): + response = await self.client.avs_assessments_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_avs_assessments_operations_begin_create(self, resource_group): + response = await ( + await self.client.avs_assessments_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "assessmentErrorSummary": {"str": 0}, + "assessmentType": "str", + "avsAssessmentScenario": "str", + "avsEstimatedExternalStorages": [ + { + "monthlyPrice": 0.0, + "storageType": "str", + "storageUtilization": 0.0, + "totalStorageInGB": 0.0, + } + ], + "avsEstimatedNetworks": [{"monthlyPrice": 0.0, "networkType": "str"}], + "avsEstimatedNodes": [ + { + "cpuUtilization": 0.0, + "fttRaidLevel": "str", + "monthlyPrice": 0.0, + "nodeNumber": 0, + "nodeType": "str", + "pricingModel": "str", + "ramUtilization": 0.0, + "storageUtilization": 0.0, + "totalCpu": 0.0, + "totalRam": 0.0, + "totalStorage": 0.0, + } + ], + "azureLocation": "str", + "azureOfferCode": "str", + "confidenceRatingInPercentage": 0.0, + "costComponents": [{"description": "str", "name": "str", "value": 0.0}], + "cpuHeadroom": 0.0, + "cpuUtilization": 0.0, + "createdTimestamp": "2020-02-20 00:00:00", + "currency": "str", + "dedupeCompression": 0.0, + "discountPercentage": 0.0, + "externalStorageTypes": ["str"], + "failuresToTolerateAndRaidLevel": "str", + "failuresToTolerateAndRaidLevelList": ["str"], + "groupType": "str", + "isStretchClusterEnabled": bool, + "isVcfByolEnabled": bool, + "limitingFactor": "str", + "memOvercommit": 0.0, + "nodeType": "str", + "nodeTypes": ["str"], + "numberOfMachines": 0, + "numberOfNodes": 0, + "percentile": "str", + "perfDataEndTime": "2020-02-20 00:00:00", + "perfDataStartTime": "2020-02-20 00:00:00", + "pricesTimestamp": "2020-02-20 00:00:00", + "provisioningState": "str", + "ramUtilization": 0.0, + "reservedInstance": "str", + "scalingFactor": 0.0, + "schemaVersion": "str", + "sizingCriterion": "str", + "stage": "str", + "status": "str", + "storageUtilization": 0.0, + "suitability": "str", + "suitabilityExplanation": "str", + "suitabilitySummary": {"str": 0}, + "timeRange": "str", + "totalCpuCores": 0.0, + "totalMonthlyCost": 0.0, + "totalRamInGB": 0.0, + "totalStorageInGB": 0.0, + "updatedTimestamp": "2020-02-20 00:00:00", + "vcpuOversubscription": 0.0, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-01-01-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_avs_assessments_operations_delete(self, resource_group): + response = await self.client.avs_assessments_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_avs_assessments_operations_begin_download_url(self, resource_group): + response = await ( + await self.client.avs_assessments_operations.begin_download_url( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + body={}, + api_version="2024-01-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_avs_summary_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_avs_summary_operations_operations.py new file mode 100644 index 000000000000..1ec2c9a37a0b --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_avs_summary_operations_operations.py @@ -0,0 +1,46 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceBusinessCaseAvsSummaryOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_business_case_avs_summary_operations_list_by_business_case(self, resource_group): + response = self.client.business_case_avs_summary_operations.list_by_business_case( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_business_case_avs_summary_operations_get(self, resource_group): + response = self.client.business_case_avs_summary_operations.get( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + avs_summary_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_avs_summary_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_avs_summary_operations_operations_async.py new file mode 100644 index 000000000000..5b0c35d25764 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_avs_summary_operations_operations_async.py @@ -0,0 +1,47 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceBusinessCaseAvsSummaryOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_business_case_avs_summary_operations_list_by_business_case(self, resource_group): + response = self.client.business_case_avs_summary_operations.list_by_business_case( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + api_version="2024-01-01-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_business_case_avs_summary_operations_get(self, resource_group): + response = await self.client.business_case_avs_summary_operations.get( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + avs_summary_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_iaas_summary_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_iaas_summary_operations_operations.py new file mode 100644 index 000000000000..e010c59d6f1b --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_iaas_summary_operations_operations.py @@ -0,0 +1,46 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceBusinessCaseIaasSummaryOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_business_case_iaas_summary_operations_list_by_business_case(self, resource_group): + response = self.client.business_case_iaas_summary_operations.list_by_business_case( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_business_case_iaas_summary_operations_get(self, resource_group): + response = self.client.business_case_iaas_summary_operations.get( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + iaas_summary_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_iaas_summary_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_iaas_summary_operations_operations_async.py new file mode 100644 index 000000000000..34db01745ffc --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_iaas_summary_operations_operations_async.py @@ -0,0 +1,47 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceBusinessCaseIaasSummaryOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_business_case_iaas_summary_operations_list_by_business_case(self, resource_group): + response = self.client.business_case_iaas_summary_operations.list_by_business_case( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + api_version="2024-01-01-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_business_case_iaas_summary_operations_get(self, resource_group): + response = await self.client.business_case_iaas_summary_operations.get( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + iaas_summary_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_operations_operations.py new file mode 100644 index 000000000000..2e73b7a76f4e --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_operations_operations.py @@ -0,0 +1,190 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceBusinessCaseOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_business_case_operations_list_by_assessment_project(self, resource_group): + response = self.client.business_case_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_business_case_operations_get(self, resource_group): + response = self.client.business_case_operations.get( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_business_case_operations_begin_create(self, resource_group): + response = self.client.business_case_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "provisioningState": "str", + "reportStatusDetails": [{"reportStatus": "str", "reportType": "str"}], + "settings": { + "azureSettings": { + "currency": "str", + "targetLocation": "str", + "avsLaborCostPercentage": 75, + "businessCaseType": "str", + "comfortFactor": 1, + "discountPercentage": 0.0, + "iaasLaborCostPercentage": 75, + "infrastructureGrowthRate": 5, + "networkCostPercentage": 5, + "paasLaborCostPercentage": 60, + "perYearMigrationCompletionPercentage": {"str": 0.0}, + "performanceDataEndTime": "2020-02-20 00:00:00", + "performanceDataStartTime": "2020-02-20 00:00:00", + "performanceUtilizationPercentile": 95, + "savingsOption": "str", + "wacc": 0.0, + "workloadDiscoverySource": "str", + }, + "azureArcSettings": { + "azureArcState": "str", + "laborCostPercentage": 0.0, + "managementSettings": {"monitoringSettings": {"alertRulesCount": 0, "logsVolumeInGB": 0.0}}, + }, + "onPremiseSettings": { + "computeSettings": { + "hyperthreadCoreToMemoryRatio": 0.0, + "price": 0.0, + "rhelLinuxServerLicensing": {"licenseCost": 0.0}, + "sqlServerLicensing": [ + {"licenseCost": 0.0, "softwareAssuranceCost": 0.0, "version": "str"} + ], + "suseLinuxServerLicensing": {"licenseCost": 0.0}, + "virtualizationSoftwareSettings": {"vMwareCloudFoundationLicenseCost": 0.0}, + "windowsServerLicensing": { + "licenseCost": 0.0, + "licensesPerCore": 0, + "softwareAssuranceCost": 0.0, + }, + }, + "facilitySettings": {"facilitiesCostPerKwh": 0.0}, + "laborSettings": { + "hourlyAdminCost": 0.0, + "physicalServersPerAdmin": 0, + "virtualMachinesPerAdmin": 0, + }, + "networkSettings": { + "hardwareSoftwareCostPercentage": 0.0, + "maintenanceCostPercentage": 0.0, + }, + "securitySettings": { + "serverSecurityCostPerServerPerYear": 0.0, + "sqlServerSecurityCostPerServerPerYear": 0.0, + }, + "storageSettings": { + "costPerGbPerMonth": 0.0, + "maintainanceCostPercentageToAcquisitionCost": 0.0, + }, + "managementSettings": { + "hypervVirtualizationManagementSettings": { + "licenseAndSupportList": [{"licenseCost": 0.0, "licenseType": "str"}], + "numberOfPhysicalCoresPerLicense": 0, + "softwareAssuranceCost": 0.0, + }, + "otherManagementCostsSettings": { + "dataProtectionCostPerServerPerYear": 0.0, + "monitoringCostPerServerPerYear": 0.0, + "patchingCostPerServerPerYear": 0.0, + }, + "thirdPartyManagementSettings": {"licenseCost": 0.0, "supportCost": 0.0}, + }, + }, + }, + "state": "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-01-01-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_business_case_operations_delete(self, resource_group): + response = self.client.business_case_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_business_case_operations_begin_compare_summary(self, resource_group): + response = self.client.business_case_operations.begin_compare_summary( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + body={}, + api_version="2024-01-01-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_business_case_operations_begin_get_report_download_url(self, resource_group): + response = self.client.business_case_operations.begin_get_report_download_url( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + body={}, + api_version="2024-01-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_operations_operations_async.py new file mode 100644 index 000000000000..a58a2c8a89ee --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_operations_operations_async.py @@ -0,0 +1,199 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceBusinessCaseOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_business_case_operations_list_by_assessment_project(self, resource_group): + response = self.client.business_case_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-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_business_case_operations_get(self, resource_group): + response = await self.client.business_case_operations.get( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_business_case_operations_begin_create(self, resource_group): + response = await ( + await self.client.business_case_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "provisioningState": "str", + "reportStatusDetails": [{"reportStatus": "str", "reportType": "str"}], + "settings": { + "azureSettings": { + "currency": "str", + "targetLocation": "str", + "avsLaborCostPercentage": 75, + "businessCaseType": "str", + "comfortFactor": 1, + "discountPercentage": 0.0, + "iaasLaborCostPercentage": 75, + "infrastructureGrowthRate": 5, + "networkCostPercentage": 5, + "paasLaborCostPercentage": 60, + "perYearMigrationCompletionPercentage": {"str": 0.0}, + "performanceDataEndTime": "2020-02-20 00:00:00", + "performanceDataStartTime": "2020-02-20 00:00:00", + "performanceUtilizationPercentile": 95, + "savingsOption": "str", + "wacc": 0.0, + "workloadDiscoverySource": "str", + }, + "azureArcSettings": { + "azureArcState": "str", + "laborCostPercentage": 0.0, + "managementSettings": { + "monitoringSettings": {"alertRulesCount": 0, "logsVolumeInGB": 0.0} + }, + }, + "onPremiseSettings": { + "computeSettings": { + "hyperthreadCoreToMemoryRatio": 0.0, + "price": 0.0, + "rhelLinuxServerLicensing": {"licenseCost": 0.0}, + "sqlServerLicensing": [ + {"licenseCost": 0.0, "softwareAssuranceCost": 0.0, "version": "str"} + ], + "suseLinuxServerLicensing": {"licenseCost": 0.0}, + "virtualizationSoftwareSettings": {"vMwareCloudFoundationLicenseCost": 0.0}, + "windowsServerLicensing": { + "licenseCost": 0.0, + "licensesPerCore": 0, + "softwareAssuranceCost": 0.0, + }, + }, + "facilitySettings": {"facilitiesCostPerKwh": 0.0}, + "laborSettings": { + "hourlyAdminCost": 0.0, + "physicalServersPerAdmin": 0, + "virtualMachinesPerAdmin": 0, + }, + "networkSettings": { + "hardwareSoftwareCostPercentage": 0.0, + "maintenanceCostPercentage": 0.0, + }, + "securitySettings": { + "serverSecurityCostPerServerPerYear": 0.0, + "sqlServerSecurityCostPerServerPerYear": 0.0, + }, + "storageSettings": { + "costPerGbPerMonth": 0.0, + "maintainanceCostPercentageToAcquisitionCost": 0.0, + }, + "managementSettings": { + "hypervVirtualizationManagementSettings": { + "licenseAndSupportList": [{"licenseCost": 0.0, "licenseType": "str"}], + "numberOfPhysicalCoresPerLicense": 0, + "softwareAssuranceCost": 0.0, + }, + "otherManagementCostsSettings": { + "dataProtectionCostPerServerPerYear": 0.0, + "monitoringCostPerServerPerYear": 0.0, + "patchingCostPerServerPerYear": 0.0, + }, + "thirdPartyManagementSettings": {"licenseCost": 0.0, "supportCost": 0.0}, + }, + }, + }, + "state": "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-01-01-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_business_case_operations_delete(self, resource_group): + response = await self.client.business_case_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_business_case_operations_begin_compare_summary(self, resource_group): + response = await ( + await self.client.business_case_operations.begin_compare_summary( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + body={}, + api_version="2024-01-01-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_business_case_operations_begin_get_report_download_url(self, resource_group): + response = await ( + await self.client.business_case_operations.begin_get_report_download_url( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + body={}, + api_version="2024-01-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_overview_summary_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_overview_summary_operations_operations.py new file mode 100644 index 000000000000..e3a65a1befc8 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_overview_summary_operations_operations.py @@ -0,0 +1,46 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceBusinessCaseOverviewSummaryOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_business_case_overview_summary_operations_list_by_business_case(self, resource_group): + response = self.client.business_case_overview_summary_operations.list_by_business_case( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_business_case_overview_summary_operations_get(self, resource_group): + response = self.client.business_case_overview_summary_operations.get( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + overview_summary_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_overview_summary_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_overview_summary_operations_operations_async.py new file mode 100644 index 000000000000..7b3e25e74f94 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_overview_summary_operations_operations_async.py @@ -0,0 +1,47 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceBusinessCaseOverviewSummaryOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_business_case_overview_summary_operations_list_by_business_case(self, resource_group): + response = self.client.business_case_overview_summary_operations.list_by_business_case( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + api_version="2024-01-01-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_business_case_overview_summary_operations_get(self, resource_group): + response = await self.client.business_case_overview_summary_operations.get( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + overview_summary_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_paas_summary_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_paas_summary_operations_operations.py new file mode 100644 index 000000000000..b11d4bbd80df --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_paas_summary_operations_operations.py @@ -0,0 +1,46 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceBusinessCasePaasSummaryOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_business_case_paas_summary_operations_list_by_business_case(self, resource_group): + response = self.client.business_case_paas_summary_operations.list_by_business_case( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_business_case_paas_summary_operations_get(self, resource_group): + response = self.client.business_case_paas_summary_operations.get( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + paas_summary_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_paas_summary_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_paas_summary_operations_operations_async.py new file mode 100644 index 000000000000..6419d2314267 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_business_case_paas_summary_operations_operations_async.py @@ -0,0 +1,47 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceBusinessCasePaasSummaryOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_business_case_paas_summary_operations_list_by_business_case(self, resource_group): + response = self.client.business_case_paas_summary_operations.list_by_business_case( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + api_version="2024-01-01-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_business_case_paas_summary_operations_get(self, resource_group): + response = await self.client.business_case_paas_summary_operations.get( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + paas_summary_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_avs_machines_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_avs_machines_operations_operations.py new file mode 100644 index 000000000000..a8c8d0d5703e --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_avs_machines_operations_operations.py @@ -0,0 +1,46 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceEvaluatedAvsMachinesOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_evaluated_avs_machines_operations_list_by_business_case(self, resource_group): + response = self.client.evaluated_avs_machines_operations.list_by_business_case( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_evaluated_avs_machines_operations_get(self, resource_group): + response = self.client.evaluated_avs_machines_operations.get( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + evaluated_avs_machine_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_avs_machines_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_avs_machines_operations_operations_async.py new file mode 100644 index 000000000000..88d9209647e7 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_avs_machines_operations_operations_async.py @@ -0,0 +1,47 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceEvaluatedAvsMachinesOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_evaluated_avs_machines_operations_list_by_business_case(self, resource_group): + response = self.client.evaluated_avs_machines_operations.list_by_business_case( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + api_version="2024-01-01-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_evaluated_avs_machines_operations_get(self, resource_group): + response = await self.client.evaluated_avs_machines_operations.get( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + evaluated_avs_machine_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_machines_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_machines_operations_operations.py new file mode 100644 index 000000000000..067aaa6a6b05 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_machines_operations_operations.py @@ -0,0 +1,46 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceEvaluatedMachinesOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_evaluated_machines_operations_list_by_business_case(self, resource_group): + response = self.client.evaluated_machines_operations.list_by_business_case( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_evaluated_machines_operations_get(self, resource_group): + response = self.client.evaluated_machines_operations.get( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + evaluated_machine_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_machines_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_machines_operations_operations_async.py new file mode 100644 index 000000000000..5b31d6c907fa --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_machines_operations_operations_async.py @@ -0,0 +1,47 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceEvaluatedMachinesOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_evaluated_machines_operations_list_by_business_case(self, resource_group): + response = self.client.evaluated_machines_operations.list_by_business_case( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + api_version="2024-01-01-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_evaluated_machines_operations_get(self, resource_group): + response = await self.client.evaluated_machines_operations.get( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + evaluated_machine_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_sql_entities_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_sql_entities_operations_operations.py new file mode 100644 index 000000000000..4694dfa753c7 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_sql_entities_operations_operations.py @@ -0,0 +1,46 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceEvaluatedSqlEntitiesOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_evaluated_sql_entities_operations_list_by_business_case(self, resource_group): + response = self.client.evaluated_sql_entities_operations.list_by_business_case( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_evaluated_sql_entities_operations_get(self, resource_group): + response = self.client.evaluated_sql_entities_operations.get( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + evaluated_sql_entity_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_sql_entities_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_sql_entities_operations_operations_async.py new file mode 100644 index 000000000000..54622011e3e3 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_sql_entities_operations_operations_async.py @@ -0,0 +1,47 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceEvaluatedSqlEntitiesOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_evaluated_sql_entities_operations_list_by_business_case(self, resource_group): + response = self.client.evaluated_sql_entities_operations.list_by_business_case( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + api_version="2024-01-01-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_evaluated_sql_entities_operations_get(self, resource_group): + response = await self.client.evaluated_sql_entities_operations.get( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + evaluated_sql_entity_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_web_apps_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_web_apps_operations_operations.py new file mode 100644 index 000000000000..c45b1005996b --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_web_apps_operations_operations.py @@ -0,0 +1,46 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceEvaluatedWebAppsOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_evaluated_web_apps_operations_list_by_business_case(self, resource_group): + response = self.client.evaluated_web_apps_operations.list_by_business_case( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_evaluated_web_apps_operations_get(self, resource_group): + response = self.client.evaluated_web_apps_operations.get( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + evaluated_web_app_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_web_apps_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_web_apps_operations_operations_async.py new file mode 100644 index 000000000000..b5922438d2ba --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_evaluated_web_apps_operations_operations_async.py @@ -0,0 +1,47 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceEvaluatedWebAppsOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_evaluated_web_apps_operations_list_by_business_case(self, resource_group): + response = self.client.evaluated_web_apps_operations.list_by_business_case( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + api_version="2024-01-01-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_evaluated_web_apps_operations_get(self, resource_group): + response = await self.client.evaluated_web_apps_operations.get( + resource_group_name=resource_group.name, + project_name="str", + business_case_name="str", + evaluated_web_app_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_groups_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_groups_operations_operations.py new file mode 100644 index 000000000000..3a58a3122de2 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_groups_operations_operations.py @@ -0,0 +1,108 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceGroupsOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_groups_operations_list_by_assessment_project(self, resource_group): + response = self.client.groups_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_groups_operations_get(self, resource_group): + response = self.client.groups_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_groups_operations_begin_create(self, resource_group): + response = self.client.groups_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "areAssessmentsRunning": bool, + "assessments": ["str"], + "createdTimestamp": "2020-02-20 00:00:00", + "groupStatus": "str", + "groupType": "str", + "machineCount": 0, + "provisioningState": "str", + "supportedAssessmentTypes": ["str"], + "updatedTimestamp": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-01-01-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_groups_operations_delete(self, resource_group): + response = self.client.groups_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_groups_operations_begin_update_machines(self, resource_group): + response = self.client.groups_operations.begin_update_machines( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + body={"eTag": "str", "properties": {"machines": ["str"], "operationType": "str"}}, + api_version="2024-01-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_groups_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_groups_operations_operations_async.py new file mode 100644 index 000000000000..9e19079e64fa --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_groups_operations_operations_async.py @@ -0,0 +1,113 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceGroupsOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_groups_operations_list_by_assessment_project(self, resource_group): + response = self.client.groups_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-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_groups_operations_get(self, resource_group): + response = await self.client.groups_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_groups_operations_begin_create(self, resource_group): + response = await ( + await self.client.groups_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "areAssessmentsRunning": bool, + "assessments": ["str"], + "createdTimestamp": "2020-02-20 00:00:00", + "groupStatus": "str", + "groupType": "str", + "machineCount": 0, + "provisioningState": "str", + "supportedAssessmentTypes": ["str"], + "updatedTimestamp": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-01-01-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_groups_operations_delete(self, resource_group): + response = await self.client.groups_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_groups_operations_begin_update_machines(self, resource_group): + response = await ( + await self.client.groups_operations.begin_update_machines( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + body={"eTag": "str", "properties": {"machines": ["str"], "operationType": "str"}}, + api_version="2024-01-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_hyperv_collectors_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_hyperv_collectors_operations_operations.py new file mode 100644 index 000000000000..40c07e9060d6 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_hyperv_collectors_operations_operations.py @@ -0,0 +1,101 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceHypervCollectorsOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_hyperv_collectors_operations_list_by_assessment_project(self, resource_group): + response = self.client.hyperv_collectors_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_hyperv_collectors_operations_get(self, resource_group): + response = self.client.hyperv_collectors_operations.get( + resource_group_name=resource_group.name, + project_name="str", + hyperv_collector_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_hyperv_collectors_operations_begin_create(self, resource_group): + response = self.client.hyperv_collectors_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + hyperv_collector_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "agentProperties": { + "id": "str", + "lastHeartbeatUtc": "2020-02-20 00:00:00", + "spnDetails": { + "applicationId": "str", + "audience": "str", + "authority": "str", + "objectId": "str", + "tenantId": "str", + }, + "version": "str", + }, + "createdTimestamp": "2020-02-20 00:00:00", + "discoverySiteId": "str", + "provisioningState": "str", + "updatedTimestamp": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-01-01-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_hyperv_collectors_operations_delete(self, resource_group): + response = self.client.hyperv_collectors_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + hyperv_collector_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_hyperv_collectors_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_hyperv_collectors_operations_operations_async.py new file mode 100644 index 000000000000..fb7cc326e8a6 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_hyperv_collectors_operations_operations_async.py @@ -0,0 +1,104 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceHypervCollectorsOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_hyperv_collectors_operations_list_by_assessment_project(self, resource_group): + response = self.client.hyperv_collectors_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-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_hyperv_collectors_operations_get(self, resource_group): + response = await self.client.hyperv_collectors_operations.get( + resource_group_name=resource_group.name, + project_name="str", + hyperv_collector_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_hyperv_collectors_operations_begin_create(self, resource_group): + response = await ( + await self.client.hyperv_collectors_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + hyperv_collector_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "agentProperties": { + "id": "str", + "lastHeartbeatUtc": "2020-02-20 00:00:00", + "spnDetails": { + "applicationId": "str", + "audience": "str", + "authority": "str", + "objectId": "str", + "tenantId": "str", + }, + "version": "str", + }, + "createdTimestamp": "2020-02-20 00:00:00", + "discoverySiteId": "str", + "provisioningState": "str", + "updatedTimestamp": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-01-01-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_hyperv_collectors_operations_delete(self, resource_group): + response = await self.client.hyperv_collectors_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + hyperv_collector_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_import_collectors_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_import_collectors_operations_operations.py new file mode 100644 index 000000000000..726528d88a32 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_import_collectors_operations_operations.py @@ -0,0 +1,89 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceImportCollectorsOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_import_collectors_operations_list_by_assessment_project(self, resource_group): + response = self.client.import_collectors_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_import_collectors_operations_get(self, resource_group): + response = self.client.import_collectors_operations.get( + resource_group_name=resource_group.name, + project_name="str", + import_collector_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_import_collectors_operations_begin_create(self, resource_group): + response = self.client.import_collectors_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + import_collector_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "createdTimestamp": "2020-02-20 00:00:00", + "discoverySiteId": "str", + "provisioningState": "str", + "updatedTimestamp": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-01-01-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_import_collectors_operations_delete(self, resource_group): + response = self.client.import_collectors_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + import_collector_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_import_collectors_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_import_collectors_operations_operations_async.py new file mode 100644 index 000000000000..214c5e5cafcc --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_import_collectors_operations_operations_async.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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceImportCollectorsOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_import_collectors_operations_list_by_assessment_project(self, resource_group): + response = self.client.import_collectors_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-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_import_collectors_operations_get(self, resource_group): + response = await self.client.import_collectors_operations.get( + resource_group_name=resource_group.name, + project_name="str", + import_collector_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_import_collectors_operations_begin_create(self, resource_group): + response = await ( + await self.client.import_collectors_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + import_collector_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "createdTimestamp": "2020-02-20 00:00:00", + "discoverySiteId": "str", + "provisioningState": "str", + "updatedTimestamp": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-01-01-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_import_collectors_operations_delete(self, resource_group): + response = await self.client.import_collectors_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + import_collector_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_machines_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_machines_operations_operations.py new file mode 100644 index 000000000000..83cd1b9f6af4 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_machines_operations_operations.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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceMachinesOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_machines_operations_list_by_assessment_project(self, resource_group): + response = self.client.machines_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_machines_operations_get(self, resource_group): + response = self.client.machines_operations.get( + resource_group_name=resource_group.name, + project_name="str", + machine_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_machines_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_machines_operations_operations_async.py new file mode 100644 index 000000000000..1bb114be7a36 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_machines_operations_operations_async.py @@ -0,0 +1,45 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceMachinesOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_machines_operations_list_by_assessment_project(self, resource_group): + response = self.client.machines_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-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_machines_operations_get(self, resource_group): + response = await self.client.machines_operations.get( + resource_group_name=resource_group.name, + project_name="str", + machine_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_operations.py new file mode 100644 index 000000000000..f73e5a8479b3 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_operations.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operations_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_operations_async.py new file mode 100644 index 000000000000..59decfb37ffb --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_operations_async.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_operations_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-01-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_private_endpoint_connection_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_private_endpoint_connection_operations_operations.py new file mode 100644 index 000000000000..335c4d947ba4 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_private_endpoint_connection_operations_operations.py @@ -0,0 +1,93 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServicePrivateEndpointConnectionOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connection_operations_list_by_assessment_project(self, resource_group): + response = self.client.private_endpoint_connection_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connection_operations_get(self, resource_group): + response = self.client.private_endpoint_connection_operations.get( + resource_group_name=resource_group.name, + project_name="str", + private_endpoint_connection_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connection_operations_begin_update(self, resource_group): + response = self.client.private_endpoint_connection_operations.begin_update( + resource_group_name=resource_group.name, + project_name="str", + private_endpoint_connection_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "groupIds": ["str"], + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-01-01-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_private_endpoint_connection_operations_delete(self, resource_group): + response = self.client.private_endpoint_connection_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + private_endpoint_connection_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_private_endpoint_connection_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_private_endpoint_connection_operations_operations_async.py new file mode 100644 index 000000000000..2baeb9ddf4ef --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_private_endpoint_connection_operations_operations_async.py @@ -0,0 +1,96 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServicePrivateEndpointConnectionOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connection_operations_list_by_assessment_project(self, resource_group): + response = self.client.private_endpoint_connection_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-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_private_endpoint_connection_operations_get(self, resource_group): + response = await self.client.private_endpoint_connection_operations.get( + resource_group_name=resource_group.name, + project_name="str", + private_endpoint_connection_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connection_operations_begin_update(self, resource_group): + response = await ( + await self.client.private_endpoint_connection_operations.begin_update( + resource_group_name=resource_group.name, + project_name="str", + private_endpoint_connection_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "groupIds": ["str"], + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-01-01-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_private_endpoint_connection_operations_delete(self, resource_group): + response = await self.client.private_endpoint_connection_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + private_endpoint_connection_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_private_link_resource_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_private_link_resource_operations_operations.py new file mode 100644 index 000000000000..88a9034d5188 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_private_link_resource_operations_operations.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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServicePrivateLinkResourceOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_link_resource_operations_list_by_assessment_project(self, resource_group): + response = self.client.private_link_resource_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_link_resource_operations_get(self, resource_group): + response = self.client.private_link_resource_operations.get( + resource_group_name=resource_group.name, + project_name="str", + private_link_resource_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_private_link_resource_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_private_link_resource_operations_operations_async.py new file mode 100644 index 000000000000..939d8aa6f724 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_private_link_resource_operations_operations_async.py @@ -0,0 +1,45 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServicePrivateLinkResourceOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_link_resource_operations_list_by_assessment_project(self, resource_group): + response = self.client.private_link_resource_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-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_private_link_resource_operations_get(self, resource_group): + response = await self.client.private_link_resource_operations.get( + resource_group_name=resource_group.name, + project_name="str", + private_link_resource_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_server_collectors_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_server_collectors_operations_operations.py new file mode 100644 index 000000000000..0023b2ed170f --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_server_collectors_operations_operations.py @@ -0,0 +1,101 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceServerCollectorsOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_server_collectors_operations_list_by_assessment_project(self, resource_group): + response = self.client.server_collectors_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_server_collectors_operations_get(self, resource_group): + response = self.client.server_collectors_operations.get( + resource_group_name=resource_group.name, + project_name="str", + server_collector_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_server_collectors_operations_begin_create(self, resource_group): + response = self.client.server_collectors_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + server_collector_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "agentProperties": { + "id": "str", + "lastHeartbeatUtc": "2020-02-20 00:00:00", + "spnDetails": { + "applicationId": "str", + "audience": "str", + "authority": "str", + "objectId": "str", + "tenantId": "str", + }, + "version": "str", + }, + "createdTimestamp": "2020-02-20 00:00:00", + "discoverySiteId": "str", + "provisioningState": "str", + "updatedTimestamp": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-01-01-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_server_collectors_operations_delete(self, resource_group): + response = self.client.server_collectors_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + server_collector_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_server_collectors_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_server_collectors_operations_operations_async.py new file mode 100644 index 000000000000..4ebbecb4b4a7 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_server_collectors_operations_operations_async.py @@ -0,0 +1,104 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceServerCollectorsOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_server_collectors_operations_list_by_assessment_project(self, resource_group): + response = self.client.server_collectors_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-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_server_collectors_operations_get(self, resource_group): + response = await self.client.server_collectors_operations.get( + resource_group_name=resource_group.name, + project_name="str", + server_collector_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_server_collectors_operations_begin_create(self, resource_group): + response = await ( + await self.client.server_collectors_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + server_collector_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "agentProperties": { + "id": "str", + "lastHeartbeatUtc": "2020-02-20 00:00:00", + "spnDetails": { + "applicationId": "str", + "audience": "str", + "authority": "str", + "objectId": "str", + "tenantId": "str", + }, + "version": "str", + }, + "createdTimestamp": "2020-02-20 00:00:00", + "discoverySiteId": "str", + "provisioningState": "str", + "updatedTimestamp": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-01-01-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_server_collectors_operations_delete(self, resource_group): + response = await self.client.server_collectors_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + server_collector_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_assessment_options_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_assessment_options_operations_operations.py new file mode 100644 index 000000000000..2d30bd75a656 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_assessment_options_operations_operations.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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceSqlAssessmentOptionsOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sql_assessment_options_operations_list_by_assessment_project(self, resource_group): + response = self.client.sql_assessment_options_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sql_assessment_options_operations_get(self, resource_group): + response = self.client.sql_assessment_options_operations.get( + resource_group_name=resource_group.name, + project_name="str", + assessment_options_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_assessment_options_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_assessment_options_operations_operations_async.py new file mode 100644 index 000000000000..dd6ef8719725 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_assessment_options_operations_operations_async.py @@ -0,0 +1,45 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceSqlAssessmentOptionsOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sql_assessment_options_operations_list_by_assessment_project(self, resource_group): + response = self.client.sql_assessment_options_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-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_sql_assessment_options_operations_get(self, resource_group): + response = await self.client.sql_assessment_options_operations.get( + resource_group_name=resource_group.name, + project_name="str", + assessment_options_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_assessment_v2_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_assessment_v2_operations_operations.py new file mode 100644 index 000000000000..6c144cf96927 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_assessment_v2_operations_operations.py @@ -0,0 +1,147 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceSqlAssessmentV2OperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sql_assessment_v2_operations_list_by_group(self, resource_group): + response = self.client.sql_assessment_v2_operations.list_by_group( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sql_assessment_v2_operations_get(self, resource_group): + response = self.client.sql_assessment_v2_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sql_assessment_v2_operations_begin_create(self, resource_group): + response = self.client.sql_assessment_v2_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "assessmentType": "str", + "asyncCommitModeIntent": "str", + "azureLocation": "str", + "azureOfferCode": "str", + "azureOfferCodeForVm": "str", + "azureSecurityOfferingType": "str", + "azureSqlDatabaseSettings": { + "azureSqlComputeTier": "str", + "azureSqlDataBaseType": "str", + "azureSqlPurchaseModel": "str", + "azureSqlServiceTier": "str", + }, + "azureSqlManagedInstanceSettings": {"azureSqlInstanceType": "str", "azureSqlServiceTier": "str"}, + "azureSqlVmSettings": {"instanceSeries": ["str"]}, + "confidenceRatingInPercentage": 0.0, + "createdTimestamp": "2020-02-20 00:00:00", + "currency": "str", + "disasterRecoveryLocation": "str", + "discountPercentage": 0.0, + "eaSubscriptionId": "str", + "enableHadrAssessment": bool, + "entityUptime": {"daysPerMonth": 0, "hoursPerDay": 0}, + "environmentType": "str", + "groupType": "str", + "isInternetAccessAvailable": bool, + "multiSubnetIntent": "str", + "optimizationLogic": "str", + "osLicense": "str", + "percentile": "str", + "perfDataEndTime": "2020-02-20 00:00:00", + "perfDataStartTime": "2020-02-20 00:00:00", + "pricesTimestamp": "2020-02-20 00:00:00", + "provisioningState": "str", + "reservedInstance": "str", + "reservedInstanceForVm": "str", + "scalingFactor": 0.0, + "schemaVersion": "str", + "sizingCriterion": "str", + "sqlServerLicense": "str", + "stage": "str", + "status": "str", + "timeRange": "str", + "updatedTimestamp": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-01-01-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_sql_assessment_v2_operations_delete(self, resource_group): + response = self.client.sql_assessment_v2_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sql_assessment_v2_operations_begin_download_url(self, resource_group): + response = self.client.sql_assessment_v2_operations.begin_download_url( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + body={}, + api_version="2024-01-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_assessment_v2_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_assessment_v2_operations_operations_async.py new file mode 100644 index 000000000000..8246e28c3cc0 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_assessment_v2_operations_operations_async.py @@ -0,0 +1,155 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceSqlAssessmentV2OperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sql_assessment_v2_operations_list_by_group(self, resource_group): + response = self.client.sql_assessment_v2_operations.list_by_group( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + api_version="2024-01-01-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_sql_assessment_v2_operations_get(self, resource_group): + response = await self.client.sql_assessment_v2_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sql_assessment_v2_operations_begin_create(self, resource_group): + response = await ( + await self.client.sql_assessment_v2_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "assessmentType": "str", + "asyncCommitModeIntent": "str", + "azureLocation": "str", + "azureOfferCode": "str", + "azureOfferCodeForVm": "str", + "azureSecurityOfferingType": "str", + "azureSqlDatabaseSettings": { + "azureSqlComputeTier": "str", + "azureSqlDataBaseType": "str", + "azureSqlPurchaseModel": "str", + "azureSqlServiceTier": "str", + }, + "azureSqlManagedInstanceSettings": { + "azureSqlInstanceType": "str", + "azureSqlServiceTier": "str", + }, + "azureSqlVmSettings": {"instanceSeries": ["str"]}, + "confidenceRatingInPercentage": 0.0, + "createdTimestamp": "2020-02-20 00:00:00", + "currency": "str", + "disasterRecoveryLocation": "str", + "discountPercentage": 0.0, + "eaSubscriptionId": "str", + "enableHadrAssessment": bool, + "entityUptime": {"daysPerMonth": 0, "hoursPerDay": 0}, + "environmentType": "str", + "groupType": "str", + "isInternetAccessAvailable": bool, + "multiSubnetIntent": "str", + "optimizationLogic": "str", + "osLicense": "str", + "percentile": "str", + "perfDataEndTime": "2020-02-20 00:00:00", + "perfDataStartTime": "2020-02-20 00:00:00", + "pricesTimestamp": "2020-02-20 00:00:00", + "provisioningState": "str", + "reservedInstance": "str", + "reservedInstanceForVm": "str", + "scalingFactor": 0.0, + "schemaVersion": "str", + "sizingCriterion": "str", + "sqlServerLicense": "str", + "stage": "str", + "status": "str", + "timeRange": "str", + "updatedTimestamp": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-01-01-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_sql_assessment_v2_operations_delete(self, resource_group): + response = await self.client.sql_assessment_v2_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sql_assessment_v2_operations_begin_download_url(self, resource_group): + response = await ( + await self.client.sql_assessment_v2_operations.begin_download_url( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + body={}, + api_version="2024-01-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_assessment_v2_summary_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_assessment_v2_summary_operations_operations.py new file mode 100644 index 000000000000..1085f992e6ce --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_assessment_v2_summary_operations_operations.py @@ -0,0 +1,48 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceSqlAssessmentV2SummaryOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sql_assessment_v2_summary_operations_list_by_sql_assessment_v2(self, resource_group): + response = self.client.sql_assessment_v2_summary_operations.list_by_sql_assessment_v2( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sql_assessment_v2_summary_operations_get(self, resource_group): + response = self.client.sql_assessment_v2_summary_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + summary_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_assessment_v2_summary_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_assessment_v2_summary_operations_operations_async.py new file mode 100644 index 000000000000..dc5299298227 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_assessment_v2_summary_operations_operations_async.py @@ -0,0 +1,49 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceSqlAssessmentV2SummaryOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sql_assessment_v2_summary_operations_list_by_sql_assessment_v2(self, resource_group): + response = self.client.sql_assessment_v2_summary_operations.list_by_sql_assessment_v2( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-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_sql_assessment_v2_summary_operations_get(self, resource_group): + response = await self.client.sql_assessment_v2_summary_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + summary_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_collector_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_collector_operations_operations.py new file mode 100644 index 000000000000..ae28ba3a69b5 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_collector_operations_operations.py @@ -0,0 +1,101 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceSqlCollectorOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sql_collector_operations_list_by_assessment_project(self, resource_group): + response = self.client.sql_collector_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sql_collector_operations_get(self, resource_group): + response = self.client.sql_collector_operations.get( + resource_group_name=resource_group.name, + project_name="str", + collector_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sql_collector_operations_begin_create(self, resource_group): + response = self.client.sql_collector_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + collector_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "agentProperties": { + "id": "str", + "lastHeartbeatUtc": "2020-02-20 00:00:00", + "spnDetails": { + "applicationId": "str", + "audience": "str", + "authority": "str", + "objectId": "str", + "tenantId": "str", + }, + "version": "str", + }, + "createdTimestamp": "2020-02-20 00:00:00", + "discoverySiteId": "str", + "provisioningState": "str", + "updatedTimestamp": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-01-01-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_sql_collector_operations_delete(self, resource_group): + response = self.client.sql_collector_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + collector_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_collector_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_collector_operations_operations_async.py new file mode 100644 index 000000000000..69b3762b6980 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_sql_collector_operations_operations_async.py @@ -0,0 +1,104 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceSqlCollectorOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sql_collector_operations_list_by_assessment_project(self, resource_group): + response = self.client.sql_collector_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-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_sql_collector_operations_get(self, resource_group): + response = await self.client.sql_collector_operations.get( + resource_group_name=resource_group.name, + project_name="str", + collector_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sql_collector_operations_begin_create(self, resource_group): + response = await ( + await self.client.sql_collector_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + collector_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "agentProperties": { + "id": "str", + "lastHeartbeatUtc": "2020-02-20 00:00:00", + "spnDetails": { + "applicationId": "str", + "audience": "str", + "authority": "str", + "objectId": "str", + "tenantId": "str", + }, + "version": "str", + }, + "createdTimestamp": "2020-02-20 00:00:00", + "discoverySiteId": "str", + "provisioningState": "str", + "updatedTimestamp": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-01-01-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_sql_collector_operations_delete(self, resource_group): + response = await self.client.sql_collector_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + collector_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_vmware_collectors_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_vmware_collectors_operations_operations.py new file mode 100644 index 000000000000..237092a5ced4 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_vmware_collectors_operations_operations.py @@ -0,0 +1,101 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceVmwareCollectorsOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_vmware_collectors_operations_list_by_assessment_project(self, resource_group): + response = self.client.vmware_collectors_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_vmware_collectors_operations_get(self, resource_group): + response = self.client.vmware_collectors_operations.get( + resource_group_name=resource_group.name, + project_name="str", + vm_ware_collector_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_vmware_collectors_operations_begin_create(self, resource_group): + response = self.client.vmware_collectors_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + vm_ware_collector_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "agentProperties": { + "id": "str", + "lastHeartbeatUtc": "2020-02-20 00:00:00", + "spnDetails": { + "applicationId": "str", + "audience": "str", + "authority": "str", + "objectId": "str", + "tenantId": "str", + }, + "version": "str", + }, + "createdTimestamp": "2020-02-20 00:00:00", + "discoverySiteId": "str", + "provisioningState": "str", + "updatedTimestamp": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-01-01-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_vmware_collectors_operations_delete(self, resource_group): + response = self.client.vmware_collectors_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + vm_ware_collector_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_vmware_collectors_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_vmware_collectors_operations_operations_async.py new file mode 100644 index 000000000000..57a7b14c93ec --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_vmware_collectors_operations_operations_async.py @@ -0,0 +1,104 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceVmwareCollectorsOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_vmware_collectors_operations_list_by_assessment_project(self, resource_group): + response = self.client.vmware_collectors_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-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_vmware_collectors_operations_get(self, resource_group): + response = await self.client.vmware_collectors_operations.get( + resource_group_name=resource_group.name, + project_name="str", + vm_ware_collector_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_vmware_collectors_operations_begin_create(self, resource_group): + response = await ( + await self.client.vmware_collectors_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + vm_ware_collector_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "agentProperties": { + "id": "str", + "lastHeartbeatUtc": "2020-02-20 00:00:00", + "spnDetails": { + "applicationId": "str", + "audience": "str", + "authority": "str", + "objectId": "str", + "tenantId": "str", + }, + "version": "str", + }, + "createdTimestamp": "2020-02-20 00:00:00", + "discoverySiteId": "str", + "provisioningState": "str", + "updatedTimestamp": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-01-01-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_vmware_collectors_operations_delete(self, resource_group): + response = await self.client.vmware_collectors_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + vm_ware_collector_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_assessment_options_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_assessment_options_operations_operations.py new file mode 100644 index 000000000000..68a35b4dc84b --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_assessment_options_operations_operations.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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceWebAppAssessmentOptionsOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_web_app_assessment_options_operations_list_by_assessment_project(self, resource_group): + response = self.client.web_app_assessment_options_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_web_app_assessment_options_operations_get(self, resource_group): + response = self.client.web_app_assessment_options_operations.get( + resource_group_name=resource_group.name, + project_name="str", + assessment_options_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_assessment_options_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_assessment_options_operations_operations_async.py new file mode 100644 index 000000000000..fb6950314264 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_assessment_options_operations_operations_async.py @@ -0,0 +1,45 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceWebAppAssessmentOptionsOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_web_app_assessment_options_operations_list_by_assessment_project(self, resource_group): + response = self.client.web_app_assessment_options_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-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_web_app_assessment_options_operations_get(self, resource_group): + response = await self.client.web_app_assessment_options_operations.get( + resource_group_name=resource_group.name, + project_name="str", + assessment_options_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_assessment_v2_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_assessment_v2_operations_operations.py new file mode 100644 index 000000000000..2e13d0adcd19 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_assessment_v2_operations_operations.py @@ -0,0 +1,132 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceWebAppAssessmentV2OperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_web_app_assessment_v2_operations_list_by_group(self, resource_group): + response = self.client.web_app_assessment_v2_operations.list_by_group( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_web_app_assessment_v2_operations_get(self, resource_group): + response = self.client.web_app_assessment_v2_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_web_app_assessment_v2_operations_begin_create(self, resource_group): + response = self.client.web_app_assessment_v2_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "appSvcContainerSettings": {"isolationRequired": bool}, + "appSvcNativeSettings": {"isolationRequired": bool}, + "assessmentType": "str", + "azureLocation": "str", + "azureOfferCode": "str", + "azureSecurityOfferingType": "str", + "confidenceRatingInPercentage": 0.0, + "createdTimestamp": "2020-02-20 00:00:00", + "currency": "str", + "discountPercentage": 0.0, + "discoveredEntityLightSummary": {"numberOfMachines": 0, "numberOfServers": 0, "numberOfWebApps": 0}, + "eaSubscriptionId": "str", + "entityUptime": {"daysPerMonth": 0, "hoursPerDay": 0}, + "environmentType": "str", + "groupType": "str", + "percentile": "str", + "perfDataEndTime": "2020-02-20 00:00:00", + "perfDataStartTime": "2020-02-20 00:00:00", + "pricesTimestamp": "2020-02-20 00:00:00", + "provisioningState": "str", + "reservedInstance": "str", + "scalingFactor": 0.0, + "schemaVersion": "str", + "sizingCriterion": "str", + "stage": "str", + "status": "str", + "timeRange": "str", + "updatedTimestamp": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-01-01-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_web_app_assessment_v2_operations_delete(self, resource_group): + response = self.client.web_app_assessment_v2_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_web_app_assessment_v2_operations_begin_download_url(self, resource_group): + response = self.client.web_app_assessment_v2_operations.begin_download_url( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + body={}, + api_version="2024-01-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_assessment_v2_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_assessment_v2_operations_operations_async.py new file mode 100644 index 000000000000..c805377202bb --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_assessment_v2_operations_operations_async.py @@ -0,0 +1,141 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceWebAppAssessmentV2OperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_web_app_assessment_v2_operations_list_by_group(self, resource_group): + response = self.client.web_app_assessment_v2_operations.list_by_group( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + api_version="2024-01-01-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_web_app_assessment_v2_operations_get(self, resource_group): + response = await self.client.web_app_assessment_v2_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_web_app_assessment_v2_operations_begin_create(self, resource_group): + response = await ( + await self.client.web_app_assessment_v2_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "appSvcContainerSettings": {"isolationRequired": bool}, + "appSvcNativeSettings": {"isolationRequired": bool}, + "assessmentType": "str", + "azureLocation": "str", + "azureOfferCode": "str", + "azureSecurityOfferingType": "str", + "confidenceRatingInPercentage": 0.0, + "createdTimestamp": "2020-02-20 00:00:00", + "currency": "str", + "discountPercentage": 0.0, + "discoveredEntityLightSummary": { + "numberOfMachines": 0, + "numberOfServers": 0, + "numberOfWebApps": 0, + }, + "eaSubscriptionId": "str", + "entityUptime": {"daysPerMonth": 0, "hoursPerDay": 0}, + "environmentType": "str", + "groupType": "str", + "percentile": "str", + "perfDataEndTime": "2020-02-20 00:00:00", + "perfDataStartTime": "2020-02-20 00:00:00", + "pricesTimestamp": "2020-02-20 00:00:00", + "provisioningState": "str", + "reservedInstance": "str", + "scalingFactor": 0.0, + "schemaVersion": "str", + "sizingCriterion": "str", + "stage": "str", + "status": "str", + "timeRange": "str", + "updatedTimestamp": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-01-01-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_web_app_assessment_v2_operations_delete(self, resource_group): + response = await self.client.web_app_assessment_v2_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_web_app_assessment_v2_operations_begin_download_url(self, resource_group): + response = await ( + await self.client.web_app_assessment_v2_operations.begin_download_url( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + body={}, + api_version="2024-01-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_assessment_v2_summary_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_assessment_v2_summary_operations_operations.py new file mode 100644 index 000000000000..f1d093d3ae38 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_assessment_v2_summary_operations_operations.py @@ -0,0 +1,48 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceWebAppAssessmentV2SummaryOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_web_app_assessment_v2_summary_operations_list_by_web_app_assessment_v2(self, resource_group): + response = self.client.web_app_assessment_v2_summary_operations.list_by_web_app_assessment_v2( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_web_app_assessment_v2_summary_operations_get(self, resource_group): + response = self.client.web_app_assessment_v2_summary_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + summary_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_assessment_v2_summary_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_assessment_v2_summary_operations_operations_async.py new file mode 100644 index 000000000000..dbb07a3a6d74 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_assessment_v2_summary_operations_operations_async.py @@ -0,0 +1,49 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceWebAppAssessmentV2SummaryOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_web_app_assessment_v2_summary_operations_list_by_web_app_assessment_v2(self, resource_group): + response = self.client.web_app_assessment_v2_summary_operations.list_by_web_app_assessment_v2( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-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_web_app_assessment_v2_summary_operations_get(self, resource_group): + response = await self.client.web_app_assessment_v2_summary_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + summary_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_collector_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_collector_operations_operations.py new file mode 100644 index 000000000000..311cd4237181 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_collector_operations_operations.py @@ -0,0 +1,101 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceWebAppCollectorOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_web_app_collector_operations_list_by_assessment_project(self, resource_group): + response = self.client.web_app_collector_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_web_app_collector_operations_get(self, resource_group): + response = self.client.web_app_collector_operations.get( + resource_group_name=resource_group.name, + project_name="str", + collector_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_web_app_collector_operations_begin_create(self, resource_group): + response = self.client.web_app_collector_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + collector_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "agentProperties": { + "id": "str", + "lastHeartbeatUtc": "2020-02-20 00:00:00", + "spnDetails": { + "applicationId": "str", + "audience": "str", + "authority": "str", + "objectId": "str", + "tenantId": "str", + }, + "version": "str", + }, + "createdTimestamp": "2020-02-20 00:00:00", + "discoverySiteId": "str", + "provisioningState": "str", + "updatedTimestamp": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-01-01-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_web_app_collector_operations_delete(self, resource_group): + response = self.client.web_app_collector_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + collector_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_collector_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_collector_operations_operations_async.py new file mode 100644 index 000000000000..9e074005478e --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_collector_operations_operations_async.py @@ -0,0 +1,104 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceWebAppCollectorOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_web_app_collector_operations_list_by_assessment_project(self, resource_group): + response = self.client.web_app_collector_operations.list_by_assessment_project( + resource_group_name=resource_group.name, + project_name="str", + api_version="2024-01-01-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_web_app_collector_operations_get(self, resource_group): + response = await self.client.web_app_collector_operations.get( + resource_group_name=resource_group.name, + project_name="str", + collector_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_web_app_collector_operations_begin_create(self, resource_group): + response = await ( + await self.client.web_app_collector_operations.begin_create( + resource_group_name=resource_group.name, + project_name="str", + collector_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "agentProperties": { + "id": "str", + "lastHeartbeatUtc": "2020-02-20 00:00:00", + "spnDetails": { + "applicationId": "str", + "audience": "str", + "authority": "str", + "objectId": "str", + "tenantId": "str", + }, + "version": "str", + }, + "createdTimestamp": "2020-02-20 00:00:00", + "discoverySiteId": "str", + "provisioningState": "str", + "updatedTimestamp": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-01-01-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_web_app_collector_operations_delete(self, resource_group): + response = await self.client.web_app_collector_operations.delete( + resource_group_name=resource_group.name, + project_name="str", + collector_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_service_plan_v2_operations_operations.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_service_plan_v2_operations_operations.py new file mode 100644 index 000000000000..aed6c9b9d6aa --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_service_plan_v2_operations_operations.py @@ -0,0 +1,48 @@ +# 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.migrationassessment import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceWebAppServicePlanV2OperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_web_app_service_plan_v2_operations_list_by_web_app_assessment_v2(self, resource_group): + response = self.client.web_app_service_plan_v2_operations.list_by_web_app_assessment_v2( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_web_app_service_plan_v2_operations_get(self, resource_group): + response = self.client.web_app_service_plan_v2_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + web_app_service_plan_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_service_plan_v2_operations_operations_async.py b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_service_plan_v2_operations_operations_async.py new file mode 100644 index 000000000000..55d887e2c3f9 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/generated_tests/test_azure_migrate_assessment_service_web_app_service_plan_v2_operations_operations_async.py @@ -0,0 +1,49 @@ +# 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.migrationassessment.aio import AzureMigrateAssessmentService + +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 TestAzureMigrateAssessmentServiceWebAppServicePlanV2OperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AzureMigrateAssessmentService, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_web_app_service_plan_v2_operations_list_by_web_app_assessment_v2(self, resource_group): + response = self.client.web_app_service_plan_v2_operations.list_by_web_app_assessment_v2( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + api_version="2024-01-01-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_web_app_service_plan_v2_operations_get(self, resource_group): + response = await self.client.web_app_service_plan_v2_operations.get( + resource_group_name=resource_group.name, + project_name="str", + group_name="str", + assessment_name="str", + web_app_service_plan_name="str", + api_version="2024-01-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/migrate/azure-mgmt-migrationassessment/sdk_packaging.toml b/sdk/migrate/azure-mgmt-migrationassessment/sdk_packaging.toml new file mode 100644 index 000000000000..07dc77c50180 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/sdk_packaging.toml @@ -0,0 +1,11 @@ +[packaging] +package_name = "azure-mgmt-migrationassessment" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" +exclude_folders = "" diff --git a/sdk/migrate/azure-mgmt-migrationassessment/setup.py b/sdk/migrate/azure-mgmt-migrationassessment/setup.py new file mode 100644 index 000000000000..11cde6d74c41 --- /dev/null +++ b/sdk/migrate/azure-mgmt-migrationassessment/setup.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-migrationassessment" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace("-", "/") +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace("-", ".") + +# Version extraction inspired from 'requests' +with open( + os.path.join(package_folder_path, "version.py") + if os.path.exists(os.path.join(package_folder_path, "version.py")) + else os.path.join(package_folder_path, "_version.py"), + "r", +) as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError("Cannot find version information") + +with open("README.md", encoding="utf-8") as f: + readme = f.read() +with open("CHANGELOG.md", encoding="utf-8") as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description="Microsoft Azure {} Client Library for Python".format(PACKAGE_PPRINT_NAME), + long_description=readme + "\n\n" + changelog, + long_description_content_type="text/markdown", + license="MIT License", + author="Microsoft Corporation", + author_email="azpysdkhelp@microsoft.com", + url="https://github.com/Azure/azure-sdk-for-python", + keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product + classifiers=[ + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "License :: OSI Approved :: MIT License", + ], + zip_safe=False, + packages=find_packages( + exclude=[ + "tests", + # Exclude packages that will be covered by PEP420 or nspkg + "azure", + "azure.mgmt", + ] + ), + include_package_data=True, + package_data={ + "pytyped": ["py.typed"], + }, + install_requires=[ + "isodate>=0.6.1", + "typing-extensions>=4.6.0", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", + ], + python_requires=">=3.8", +) diff --git a/sdk/migrate/ci.yml b/sdk/migrate/ci.yml new file mode 100644 index 000000000000..49c53264efc7 --- /dev/null +++ b/sdk/migrate/ci.yml @@ -0,0 +1,34 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/migrate/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/migrate/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: migrate + TestProxy: true + Artifacts: + - name: azure-mgmt-migrationassessment + safeName: azuremgmtmigrationassessment